33from .errors import ParseError
44
55
6+ INLINE_WS = (' ' , '\t ' )
7+
8+
69class FTLParserStream (ParserStream ):
7- def peek_line_ws (self ):
10+ def peek_inline_ws (self ):
811 ch = self .current_peek ()
912 while ch :
10- if ch != ' ' and ch != ' \t ' :
13+ if ch not in INLINE_WS :
1114 break
1215 ch = self .peek ()
1316
14- def skip_ws_lines (self ):
17+ def skip_blank_lines (self ):
1518 while True :
16- self .peek_line_ws ()
19+ self .peek_inline_ws ()
1720
1821 if self .current_peek_is ('\n ' ):
1922 self .skip_to_peek ()
@@ -22,9 +25,9 @@ def skip_ws_lines(self):
2225 self .reset_peek ()
2326 break
2427
25- def skip_line_ws (self ):
28+ def skip_inline_ws (self ):
2629 while self .ch :
27- if self .ch != ' ' and self . ch != ' \t ' :
30+ if self .ch not in INLINE_WS :
2831 break
2932 self .next ()
3033
@@ -67,19 +70,6 @@ def is_number_start(self):
6770
6871 return (cc >= 48 and cc <= 57 ) or cc == 45
6972
70- def is_peek_next_line_indented (self ):
71- if not self .current_peek_is ('\n ' ):
72- return False
73-
74- self .peek ()
75-
76- if self .current_peek_is (' ' ):
77- self .reset_peek ()
78- return True
79-
80- self .reset_peek ()
81- return False
82-
8373 def is_peek_next_line_variant_start (self ):
8474 if not self .current_peek_is ('\n ' ):
8575 return False
@@ -88,7 +78,7 @@ def is_peek_next_line_variant_start(self):
8878
8979 ptr = self .get_peek_index ()
9080
91- self .peek_line_ws ()
81+ self .peek_inline_ws ()
9282
9383 if (self .get_peek_index () - ptr == 0 ):
9484 self .reset_peek ()
@@ -112,7 +102,7 @@ def is_peek_next_line_attribute_start(self):
112102
113103 ptr = self .get_peek_index ()
114104
115- self .peek_line_ws ()
105+ self .peek_inline_ws ()
116106
117107 if (self .get_peek_index () - ptr == 0 ):
118108 self .reset_peek ()
@@ -133,7 +123,7 @@ def is_peek_next_line_pattern(self):
133123
134124 ptr = self .get_peek_index ()
135125
136- self .peek_line_ws ()
126+ self .peek_inline_ws ()
137127
138128 if (self .get_peek_index () - ptr == 0 ):
139129 self .reset_peek ()
@@ -159,7 +149,7 @@ def is_peek_next_line_tag_start(self):
159149
160150 ptr = self .get_peek_index ()
161151
162- self .peek_line_ws ()
152+ self .peek_inline_ws ()
163153
164154 if (self .get_peek_index () - ptr == 0 ):
165155 self .reset_peek ()
@@ -173,14 +163,15 @@ def is_peek_next_line_tag_start(self):
173163 return False
174164
175165 def skip_to_next_entry_start (self ):
176- while self .next () :
166+ while self .ch :
177167 if self .current_is ('\n ' ) and not self .peek_char_is ('\n ' ):
178168 self .next ()
179169
180170 if self .ch is None or self .is_id_start () or \
181171 (self .current_is ('/' ) and self .peek_char_is ('/' )) or \
182172 (self .current_is ('[' ) and self .peek_char_is ('[' )):
183173 break
174+ self .next ()
184175
185176 def take_id_start (self ):
186177 if self .is_id_start ():
0 commit comments