Commit cb88d559 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

[css, dom] Improve docs on partmap parser.

Make the state transitions more clear and document which transitions
consume a character.

Bug: 805271

Change-Id: I363cb6c9d459b560d0ec1b4cb6649cce981deffc
Reviewed-on: https://chromium-review.googlesource.com/c/1275747Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599092}
parent 5de92169
...@@ -45,15 +45,26 @@ void NamesMap::Add(const AtomicString& key, const AtomicString& value) { ...@@ -45,15 +45,26 @@ void NamesMap::Add(const AtomicString& key, const AtomicString& value) {
// second and => is not used to separate key and value. It also allows an ident // second and => is not used to separate key and value. It also allows an ident
// token on its own as a short-hand for forwarding with the same name. // token on its own as a short-hand for forwarding with the same name.
// The states that can occur while parsing the part map. {...} denotes the new // The states that can occur while parsing the part map and their transitions.
// states that can be reached from this state. // A "+" indicates that this transition should consume the current character.
enum State { enum State {
kPreKey, // Searching for the start of a key. {kPreKey, kKey} kPreKey, // Searching for the start of a key:
kKey, // Searching for the end of a key. {kKey, kPreValue} // space, comma -> kPreKey+
kPreValue, // Searching for the start of a value. {kPreValue, kPreKey, // else -> kKey
// kValue} kKey, // Searching for the end of a key:
kValue, // Searching for the end of a value. {kValue, kPreKey, kPostValue} // space, comma -> kPreValue
kPostValue, // Searching for the comma after the value. {kPostValue, kPreKey} // else -> kKey+
kPreValue, // Searching for the start of a value:
// space -> kPreValue+
// comma -> kPreKey+
// else -> kValue+
kValue, // Searching for the end of a value:
// comma -> kPreKey+
// space -> kPostValue+
// else -> kValue+
kPostValue, // Searching for the comma after the value:
// comma -> kPreKey+
// else -> kPostValue+
}; };
template <typename CharacterType> template <typename CharacterType>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment