OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Generates a syntax tree from a Mojo IDL file.""" | 6 """Generates a syntax tree from a Mojo IDL file.""" |
7 | 7 |
8 | 8 |
9 import os.path | 9 import os.path |
10 import sys | 10 import sys |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 p[0] = "handle<" + p[3] + ">" | 208 p[0] = "handle<" + p[3] + ">" |
209 | 209 |
210 def p_specializedhandlename(self, p): | 210 def p_specializedhandlename(self, p): |
211 """specializedhandlename : DATA_PIPE_CONSUMER | 211 """specializedhandlename : DATA_PIPE_CONSUMER |
212 | DATA_PIPE_PRODUCER | 212 | DATA_PIPE_PRODUCER |
213 | MESSAGE_PIPE | 213 | MESSAGE_PIPE |
214 | SHARED_BUFFER""" | 214 | SHARED_BUFFER""" |
215 p[0] = p[1] | 215 p[0] = p[1] |
216 | 216 |
217 def p_array(self, p): | 217 def p_array(self, p): |
218 """array : basictypename LBRACKET RBRACKET""" | 218 """array : typename LBRACKET RBRACKET""" |
219 p[0] = p[1] + "[]" | 219 p[0] = p[1] + "[]" |
220 | 220 |
221 def p_ordinal(self, p): | 221 def p_ordinal(self, p): |
222 """ordinal : ORDINAL | 222 """ordinal : ORDINAL |
223 | """ | 223 | """ |
224 if len(p) > 1: | 224 if len(p) > 1: |
225 value = int(p[1][1:]) | 225 value = int(p[1][1:]) |
226 if value > _MAX_ORDINAL_VALUE: | 226 if value > _MAX_ORDINAL_VALUE: |
227 raise ParseError(self.filename, "Ordinal value %d too large:" % value, | 227 raise ParseError(self.filename, "Ordinal value %d too large:" % value, |
228 lineno=p.lineno(1), | 228 lineno=p.lineno(1), |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 print Parse(f.read(), filename) | 382 print Parse(f.read(), filename) |
383 except ParseError, e: | 383 except ParseError, e: |
384 print e | 384 print e |
385 return 1 | 385 return 1 |
386 | 386 |
387 return 0 | 387 return 0 |
388 | 388 |
389 | 389 |
390 if __name__ == '__main__': | 390 if __name__ == '__main__': |
391 sys.exit(main(sys.argv)) | 391 sys.exit(main(sys.argv)) |
OLD | NEW |