| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 p[0] = self.__cat(p[1], p[2]) | 207 p[0] = self.__cat(p[1], p[2]) |
| 208 | 208 |
| 209 def p_fragment(self, p): | 209 def p_fragment(self, p): |
| 210 '''fragment : literal maybe_modifier | 210 '''fragment : literal maybe_modifier |
| 211 | class maybe_modifier | 211 | class maybe_modifier |
| 212 | group maybe_modifier | 212 | group maybe_modifier |
| 213 | any maybe_modifier | 213 | any maybe_modifier |
| 214 ''' | 214 ''' |
| 215 if p[2]: | 215 if p[2]: |
| 216 if p[2][0] == 'REPEAT': | 216 if p[2][0] == 'REPEAT': |
| 217 p[0] = Term(p[2][0], p[2][1], p[2][2], p[1]) | 217 p[0] = Term(p[2][0], p[1], p[2][1], p[2][2]) |
| 218 else: | 218 else: |
| 219 p[0] = Term(p[2][0], p[1]) | 219 p[0] = Term(p[2][0], p[1]) |
| 220 else: | 220 else: |
| 221 p[0] = p[1] | 221 p[0] = p[1] |
| 222 | 222 |
| 223 def p_maybe_modifier(self, p): | 223 def p_maybe_modifier(self, p): |
| 224 '''maybe_modifier : ONE_OR_MORE | 224 '''maybe_modifier : ONE_OR_MORE |
| 225 | ZERO_OR_ONE | 225 | ZERO_OR_ONE |
| 226 | ZERO_OR_MORE | 226 | ZERO_OR_MORE |
| 227 | REPEAT_BEGIN NUMBER REPEAT_END | 227 | REPEAT_BEGIN NUMBER REPEAT_END |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 @staticmethod | 284 @staticmethod |
| 285 def __cat(left, right): | 285 def __cat(left, right): |
| 286 assert left | 286 assert left |
| 287 return NfaBuilder.cat_terms([left] if not right else [left, right]) | 287 return NfaBuilder.cat_terms([left] if not right else [left, right]) |
| 288 | 288 |
| 289 @staticmethod | 289 @staticmethod |
| 290 def parse(string): | 290 def parse(string): |
| 291 new_lexer = lambda: RegexLexer() | 291 new_lexer = lambda: RegexLexer() |
| 292 new_parser = lambda: RegexParser() | 292 new_parser = lambda: RegexParser() |
| 293 return ParserBuilder.parse(string, "RegexParser", new_lexer, new_parser) | 293 return ParserBuilder.parse(string, "RegexParser", new_lexer, new_parser) |
| OLD | NEW |