3 pygments.lexers.parsers |
3 pygments.lexers.parsers |
4 ~~~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexers for parser generators. |
6 Lexers for parser generators. |
7 |
7 |
8 :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 import re |
12 import re |
13 |
13 |
70 'identifiers': [ |
70 'identifiers': [ |
71 (r'[a-zA-Z_][a-zA-Z_0-9]*', Name.Variable), |
71 (r'[a-zA-Z_][a-zA-Z_0-9]*', Name.Variable), |
72 ], |
72 ], |
73 'operators': [ |
73 'operators': [ |
74 (r',', Operator), # Join |
74 (r',', Operator), # Join |
75 (r'\||&|-|--', Operator), # Union, Intersection and Subtraction |
75 (r'\||&|--?', Operator), # Union, Intersection and Subtraction |
76 (r'\.|<:|:>|:>>', Operator), # Concatention |
76 (r'\.|<:|:>>?', Operator), # Concatention |
77 (r':', Operator), # Label |
77 (r':', Operator), # Label |
78 (r'->', Operator), # Epsilon Transition |
78 (r'->', Operator), # Epsilon Transition |
79 (r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # EOF Actions |
79 (r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # EOF Actions |
80 (r'(>|\$|%|<|@|<>)(!|err\b)', Operator), # Global Error Actions |
80 (r'(>|\$|%|<|@|<>)(!|err\b)', Operator), # Global Error Actions |
81 (r'(>|\$|%|<|@|<>)(\^|lerr\b)', Operator), # Local Error Actions |
81 (r'(>|\$|%|<|@|<>)(\^|lerr\b)', Operator), # Local Error Actions |
391 (r'\[', Punctuation, 'nested-arg-action'), |
391 (r'\[', Punctuation, 'nested-arg-action'), |
392 (r'\{', Punctuation, 'action'), |
392 (r'\{', Punctuation, 'action'), |
393 # throwsSpec |
393 # throwsSpec |
394 (r'(throws)(\s+)(' + _id + ')', |
394 (r'(throws)(\s+)(' + _id + ')', |
395 bygroups(Keyword, Whitespace, Name.Label)), |
395 bygroups(Keyword, Whitespace, Name.Label)), |
396 (r'(?:(,)(\s*)(' + _id + '))+', |
396 (r'(,)(\s*)(' + _id + ')', |
397 bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws |
397 bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws |
398 # optionsSpec |
398 # optionsSpec |
399 (r'options\b', Keyword, 'options'), |
399 (r'options\b', Keyword, 'options'), |
400 # ruleScopeSpec - scope followed by target language code or name of action |
400 # ruleScopeSpec - scope followed by target language code or name of action |
401 # TODO finish implementing other possibilities for scope |
401 # TODO finish implementing other possibilities for scope |