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

Side by Side Diff: mojo/public/bindings/pylib/parse/mojo_lexer.py

Issue 213693004: Mojo: Mojom: Remove relational (e.g., !=) and logical operators (e.g., || and !). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 9 months 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 | « no previous file | mojo/public/bindings/pylib/parse/mojo_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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import re 5 import re
6 import sys 6 import sys
7 import os.path 7 import os.path
8 8
9 # Try to load the ply module, if not, then assume it is in the third_party 9 # Try to load the ply module, if not, then assume it is in the third_party
10 # directory. 10 # directory.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 79 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX',
80 'FLOAT_CONST', 'HEX_FLOAT_CONST', 80 'FLOAT_CONST', 'HEX_FLOAT_CONST',
81 'CHAR_CONST', 81 'CHAR_CONST',
82 82
83 # String literals 83 # String literals
84 'STRING_LITERAL', 84 'STRING_LITERAL',
85 85
86 # Operators 86 # Operators
87 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD', 87 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD',
88 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', 88 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT',
89 'LOR', 'LAND', 'LNOT',
90 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE',
91 89
92 # Assignment 90 # Assignment
93 'EQUALS', 91 'EQUALS',
94 92
95 # Request / response 93 # Request / response
96 'RESPONSE', 94 'RESPONSE',
97 95
98 # Delimiters 96 # Delimiters
99 'LPAREN', 'RPAREN', # ( ) 97 'LPAREN', 'RPAREN', # ( )
100 'LBRACKET', 'RBRACKET', # [ ] 98 'LBRACKET', 'RBRACKET', # [ ]
101 'LBRACE', 'RBRACE', # { } 99 'LBRACE', 'RBRACE', # { }
100 'LANGLE', 'RANGLE', # < >
102 'SEMI', # ; 101 'SEMI', # ;
103 'COMMA', 'DOT' # , . 102 'COMMA', 'DOT' # , .
104 ) 103 )
105 104
106 ## 105 ##
107 ## Regexes for use in tokens 106 ## Regexes for use in tokens
108 ## 107 ##
109 108
110 # valid C identifiers (K&R2: A.2.3), plus '$' (supported by some compilers) 109 # valid C identifiers (K&R2: A.2.3), plus '$' (supported by some compilers)
111 identifier = r'[a-zA-Z_$][0-9a-zA-Z_$]*' 110 identifier = r'[a-zA-Z_$][0-9a-zA-Z_$]*'
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 t_MINUS = r'-' 176 t_MINUS = r'-'
178 t_TIMES = r'\*' 177 t_TIMES = r'\*'
179 t_DIVIDE = r'/' 178 t_DIVIDE = r'/'
180 t_MOD = r'%' 179 t_MOD = r'%'
181 t_OR = r'\|' 180 t_OR = r'\|'
182 t_AND = r'&' 181 t_AND = r'&'
183 t_NOT = r'~' 182 t_NOT = r'~'
184 t_XOR = r'\^' 183 t_XOR = r'\^'
185 t_LSHIFT = r'<<' 184 t_LSHIFT = r'<<'
186 t_RSHIFT = r'>>' 185 t_RSHIFT = r'>>'
187 t_LOR = r'\|\|'
188 t_LAND = r'&&'
189 t_LNOT = r'!'
190 t_LT = r'<'
191 t_GT = r'>'
192 t_LE = r'<='
193 t_GE = r'>='
194 t_EQ = r'=='
195 t_NE = r'!='
196 186
197 # = 187 # =
198 t_EQUALS = r'=' 188 t_EQUALS = r'='
199 189
200 # => 190 # =>
201 t_RESPONSE = r'=>' 191 t_RESPONSE = r'=>'
202 192
203 # Delimiters 193 # Delimiters
204 t_LPAREN = r'\(' 194 t_LPAREN = r'\('
205 t_RPAREN = r'\)' 195 t_RPAREN = r'\)'
206 t_LBRACKET = r'\[' 196 t_LBRACKET = r'\['
207 t_RBRACKET = r'\]' 197 t_RBRACKET = r'\]'
208 t_LBRACE = r'\{' 198 t_LBRACE = r'\{'
209 t_RBRACE = r'\}' 199 t_RBRACE = r'\}'
200 t_LANGLE = r'<'
201 t_RANGLE = r'>'
210 t_COMMA = r',' 202 t_COMMA = r','
211 t_DOT = r'\.' 203 t_DOT = r'\.'
212 t_SEMI = r';' 204 t_SEMI = r';'
213 205
214 t_STRING_LITERAL = string_literal 206 t_STRING_LITERAL = string_literal
215 t_ORDINAL = r'@[0-9]*' 207 t_ORDINAL = r'@[0-9]*'
216 208
217 # The following floating and integer constants are defined as 209 # The following floating and integer constants are defined as
218 # functions to impose a strict order (otherwise, decimal 210 # functions to impose a strict order (otherwise, decimal
219 # is placed before the others because its regex is longer, 211 # is placed before the others because its regex is longer,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return t 266 return t
275 267
276 # Ignore C and C++ style comments 268 # Ignore C and C++ style comments
277 def t_COMMENT(self, t): 269 def t_COMMENT(self, t):
278 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' 270 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)'
279 pass 271 pass
280 272
281 def t_error(self, t): 273 def t_error(self, t):
282 msg = 'Illegal character %s' % repr(t.value[0]) 274 msg = 'Illegal character %s' % repr(t.value[0])
283 self._error(msg, t) 275 self._error(msg, t)
OLDNEW
« no previous file with comments | « no previous file | mojo/public/bindings/pylib/parse/mojo_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698