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

Side by Side Diff: src/trusted/validator_arm/dgen_input.py

Issue 7799013: Intial Thumb2 Sandbox (naclrev 6680) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: asdsa Created 9 years, 2 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2009 The Native Client Authors. All rights reserved. 3 # Copyright 2011 The Native Client Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can 4 # Use of this source code is governed by a BSD-style license that can
5 # be found in the LICENSE file. 5 # be found in the LICENSE file.
6 # Copyright 2009, Google Inc. 6 # Copyright 2011, Google Inc.
7 # 7 #
8 8
9 """ 9 """
10 A simple recursive-descent parser for the table file format. 10 A simple recursive-descent parser for the table file format.
11 11
12 The grammar implemented here is roughly (taking some liberties with whitespace 12 The grammar implemented here is roughly (taking some liberties with whitespace
13 and comment parsing): 13 and comment parsing):
14 14
15 table_file ::= ( BLANK_LINE | table_def ) end_of_file ; 15 table_file ::= ( BLANK_LINE | table_def ) end_of_file ;
16 table_def ::= "--" IDENT CITATION NL 16 table_def ::= "--" IDENT CITATION NL
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 def end_of_file(): 111 def end_of_file():
112 return _line is None 112 return _line is None
113 113
114 114
115 def next_line(): 115 def next_line():
116 global _line_no, _line 116 global _line_no, _line
117 117
118 _line_no += 1 118 _line_no += 1
119 _line = _in.readline() 119 _line = _in.readline()
120 if _line: 120 if _line:
121 old_line = _line.strip()
121 _line = re.sub(r'#.*', '', _line).strip() 122 _line = re.sub(r'#.*', '', _line).strip()
123 if (old_line != _line) and (len(_line) == 0): # If we ate it all
124 next_line() # Get another one to allow line comments.
122 else: 125 else:
123 _line = None 126 _line = None
124 127
125 128
126 def unexpected(): 129 def unexpected():
127 raise Exception('Line %d: Unexpected line in input: %s' % (_line_no, _line)) 130 raise Exception('Line %d: Unexpected line in input: %s' % (_line_no, _line))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698