Mercurial > hg > octave-lyh
comparison libinterp/parse-tree/lex.h @ 16265:71ee3afedb69
5/10 commits reworking the lexer
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 11 Mar 2013 14:29:19 -0400 |
parents | 9acb86e6ac90 |
children | 36e01847694f 15f55df088e7 |
comparison
equal
deleted
inserted
replaced
16263:9acb86e6ac90 | 16265:71ee3afedb69 |
---|---|
71 | 71 |
72 enum bracket_type | 72 enum bracket_type |
73 { | 73 { |
74 BRACKET = 1, | 74 BRACKET = 1, |
75 BRACE = 2, | 75 BRACE = 2, |
76 PAREN = 3 | 76 PAREN = 3, |
77 ANON_FCN_BODY = 4 | |
77 }; | 78 }; |
78 | 79 |
79 public: | 80 public: |
80 | 81 |
81 bbp_nesting_level (void) : context () { } | 82 bbp_nesting_level (void) : context () { } |
115 void paren (void) { context.push (PAREN); } | 116 void paren (void) { context.push (PAREN); } |
116 | 117 |
117 bool is_paren (void) | 118 bool is_paren (void) |
118 { | 119 { |
119 return ! context.empty () && context.top () == PAREN; | 120 return ! context.empty () && context.top () == PAREN; |
121 } | |
122 | |
123 void anon_fcn_body (void) { context.push (ANON_FCN_BODY); } | |
124 | |
125 bool is_anon_fcn_body (void) | |
126 { | |
127 return ! context.empty () && context.top () == ANON_FCN_BODY; | |
120 } | 128 } |
121 | 129 |
122 bool is_bracket_or_brace (void) | 130 bool is_bracket_or_brace (void) |
123 { | 131 { |
124 return (! context.empty () | 132 return (! context.empty () |
383 std::stack<bool> parsed_function_name; | 391 std::stack<bool> parsed_function_name; |
384 | 392 |
385 // set of identifiers that might be local variable names. | 393 // set of identifiers that might be local variable names. |
386 std::set<std::string> pending_local_variables; | 394 std::set<std::string> pending_local_variables; |
387 | 395 |
388 // is the closest nesting level a square bracket, squiggly brace or | 396 // is the closest nesting level a square bracket, squiggly brace, |
389 // a paren? | 397 // a paren, or an anonymous function body? |
390 bbp_nesting_level nesting_level; | 398 bbp_nesting_level nesting_level; |
391 | 399 |
392 // Tokens generated by the lexer. | 400 // Tokens generated by the lexer. |
393 token_cache tokens; | 401 token_cache tokens; |
394 | 402 |