File tree Expand file tree Collapse file tree 5 files changed +23
-6
lines changed
tests/syntax/fixtures_structure Expand file tree Collapse file tree 5 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,20 @@ def is_number_start(self):
7070
7171 return (cc >= 48 and cc <= 57 ) or cc == 45
7272
73+ def is_peek_next_line_comment (self ):
74+ if not self .current_peek_is ('\n ' ):
75+ return False
76+
77+ self .peek ()
78+ if self .current_peek_is ('/' ):
79+ self .peek ()
80+ if self .current_peek_is ('/' ):
81+ self .reset_peek ()
82+ return True
83+
84+ self .reset_peek ()
85+ return False
86+
7387 def is_peek_next_line_variant_start (self ):
7488 if not self .current_peek_is ('\n ' ):
7589 return False
Original file line number Diff line number Diff line change @@ -90,6 +90,10 @@ def get_entry(self, ps):
9090 if ps .current_is ('/' ):
9191 comment = self .get_comment (ps )
9292
93+ # The Comment content doesn't include the trailing newline. Consume
94+ # this newline to be ready for the next entry. None stands for EOF.
95+ ps .expect_char ('\n ' if ps .current () else None )
96+
9397 if ps .current_is ('[' ):
9498 return self .get_section (ps , comment )
9599
@@ -118,12 +122,11 @@ def until_eol(x):
118122 content += ch
119123 ch = ps .take_char (until_eol )
120124
121- ps .next ()
122-
123- if ps .current_is ('/' ):
125+ if ps .is_peek_next_line_comment ():
124126 content += '\n '
125127 ps .next ()
126128 ps .expect_char ('/' )
129+ ps .expect_char ('/' )
127130 ps .take_char_if (' ' )
128131 else :
129132 break
Original file line number Diff line number Diff line change 88 "span" : {
99 "type" : " Span" ,
1010 "start" : 0 ,
11- "end" : 53
11+ "end" : 52
1212 }
1313 },
1414 "span" : {
Original file line number Diff line number Diff line change 88 "span" : {
99 "type" : " Span" ,
1010 "start" : 0 ,
11- "end" : 53
11+ "end" : 52
1212 }
1313 },
1414 "span" : {
Original file line number Diff line number Diff line change 4848 "span" : {
4949 "type" : " Span" ,
5050 "start" : 13 ,
51- "end" : 45
51+ "end" : 44
5252 }
5353 }
5454 ],
You can’t perform that action at this time.
0 commit comments