diff options
author | Markus Roberts <Markus@reality.com> | 2009-09-23 16:58:14 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2009-10-16 11:56:40 -0700 |
commit | ce46be5773656f68eddc7edd6212e283b46f9320 (patch) | |
tree | e7d752c707fd3520bbeebd7edb6b6dc8059433e9 /lib/puppet/util/json.rb | |
parent | b0518c3938be6cef34eafeb0460116d98b2a64ca (diff) | |
download | puppet-ce46be5773656f68eddc7edd6212e283b46f9320.tar.gz puppet-ce46be5773656f68eddc7edd6212e283b46f9320.tar.xz puppet-ce46be5773656f68eddc7edd6212e283b46f9320.zip |
Proposed alternative solution for #2664 (REGEX / DIV lexing)
This is my proposed attack on the lexing problem, with a few minor
cleanups to simplify its integration. The strategy:
* Anotate tokens with a method "acceptable?" that determines if
they can be generated in a given context. Have this default
to true.
* Give the lexer the notion of a context; initialize it and
update it as needed. The present context records the name of
the last significant token generated and a start_of_line flag.
* When a token is found to match, check if it is acceptable in
the present context before generating it.
These changes don't result any any change in behaviour but they
enable:
* Give the REGEX token an acceptable? rule that only permits a
regular expression in specific contexts.
The other changes were a fix to the scan bug Brice reported,
adjusting a test and clearing up some cluttered conditions in the
context collection path.
Added tests and subsumed change restricting REGEX to one line.
Diffstat (limited to 'lib/puppet/util/json.rb')
0 files changed, 0 insertions, 0 deletions