Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: tools/lexer_generator/code_generator.py

Issue 64913011: Experimental parser: implement skip (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lexer/lexer_py.re ('k') | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 state.node_number()) 68 state.node_number())
69 69
70 action = state.action() 70 action = state.action()
71 if action: 71 if action:
72 if action.type() == 'terminate': 72 if action.type() == 'terminate':
73 code += 'PUSH_TOKEN(Token::EOS); return 0;' 73 code += 'PUSH_TOKEN(Token::EOS); return 0;'
74 return code 74 return code
75 elif action.type() == 'terminate_illegal': 75 elif action.type() == 'terminate_illegal':
76 code += 'PUSH_TOKEN(Token::ILLEGAL); return 1;' 76 code += 'PUSH_TOKEN(Token::ILLEGAL); return 1;'
77 return code 77 return code
78 elif action.type() == 'skip':
79 code += 'SKIP(); goto code_start;'
80 return code
78 81
79 code += ''' 82 code += '''
80 //fprintf(stderr, "char at hand is %c (%d)\\n", yych, yych);\n''' 83 //fprintf(stderr, "char at hand is %c (%d)\\n", yych, yych);\n'''
81 84
82 for key, s in state.transitions().items(): 85 for key, s in state.transitions().items():
83 code += CodeGenerator.key_to_code(key) 86 code += CodeGenerator.key_to_code(key)
84 code += ''' { 87 code += ''' {
85 FORWARD(); 88 FORWARD();
86 goto code_%s; 89 goto code_%s;
87 } 90 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 code += ''' 140 code += '''
138 CHECK(false); 141 CHECK(false);
139 %s 142 %s
140 return 0; 143 return 0;
141 } 144 }
142 145
143 } 146 }
144 } 147 }
145 ''' % default_action_code 148 ''' % default_action_code
146 return code 149 return code
OLDNEW
« no previous file with comments | « src/lexer/lexer_py.re ('k') | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698