| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 "<<" { SHL } | 58 "<<" { SHL } |
| 59 " " { SPACE } | 59 " " { SPACE } |
| 60 eof <<terminate>>''' | 60 eof <<terminate>>''' |
| 61 | 61 |
| 62 lexer = Lexer(rules) | 62 lexer = Lexer(rules) |
| 63 | 63 |
| 64 string = '<< <\0' | 64 string = '<< <\0' |
| 65 self.__verify_action_stream( | 65 self.__verify_action_stream( |
| 66 lexer.lex(string), | 66 lexer.lex(string), |
| 67 [('SHL', '<<'), ('SPACE', ' '), ('LT', '<')]) | 67 [('SHL', '<<'), ('SPACE', ' '), ('LT', '<')]) |
| 68 |
| 69 |
| 70 def test_consecutive_epsilon_transitions(self): |
| 71 # This rule set will create a NFA where we first have an epsilon transition, |
| 72 # then following that, an epsilon transition with an action. This will test |
| 73 # that the action is correctly pulled forward when creating the dfa. |
| 74 rules = ''' |
| 75 digit = [0-9]; |
| 76 number = (digit+ ("." digit+)?); |
| 77 <default> |
| 78 number { NUMBER } |
| 79 eof <<terminate>>''' |
| 80 |
| 81 lexer = Lexer(rules) |
| 82 |
| 83 string = '555\0' |
| 84 self.__verify_action_stream( |
| 85 lexer.lex(string), |
| 86 [('NUMBER', '555')]) |
| OLD | NEW |