File tree Expand file tree Collapse file tree
lib/interscript/isc/grammar/concerns Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,18 +213,23 @@ module Interscript
213213 @out << "\n #{ indent } }"
214214 elsif @scanner . scan ( /(?:\A |\n )([ \t ]+)description[ \t ]*:[ \t ]*\n [ \t ]+/ )
215215 # `description:` with value on subsequent indented line(s).
216- # Capture as brace block with raw text.
216+ # Capture as brace block with raw text. Continues until dedent
217+ # back to indent level or close brace.
217218 indent = @scanner [ 1 ]
218219 @out << "\n #{ indent } description { "
219220 # Read until dedent or close brace
220221 until @scanner . eos?
221- if @scanner . check ( /\n [ \t ]{0,#{ indent . length } }\S / ) || @scanner . check ( /\n [ \t ]{0,#{ indent . length } }\} / )
222+ if @scanner . check ( /\n (?:[ \t ]*\n )*([ \t ]{0,#{ indent . length } }\S )/ ) ||
223+ @scanner . check ( /\n (?:[ \t ]*\n )*[ \t ]{0,#{ indent . length } }\} / )
222224 @out << " }"
223225 break
224226 elsif @scanner . scan ( /[^\n ]+/ )
225227 @out << @scanner . matched
226228 elsif @scanner . scan ( /\n [ \t ]+/ )
227229 @out << " "
230+ elsif @scanner . scan ( /\n [ \t ]*\n / )
231+ # Blank line — preserve as space
232+ @out << " "
228233 elsif @scanner . scan ( /\n / )
229234 @out << " "
230235 else
Original file line number Diff line number Diff line change @@ -91,7 +91,9 @@ module Items
9191
9292 # ref(N) — reference to Nth capture group. Only valid in `to` position.
9393 rule ( :capture_reference ) do
94- ( str ( "ref" ) >> str ( "(" ) >> match ( /[0-9]/ ) . as ( :digit ) >> str ( ")" ) ) . as ( :ref )
94+ ( str ( "ref" ) >> str ( "(" ) >> whitespace? >>
95+ match ( /[0-9]/ ) . as ( :digit ) >> whitespace? >>
96+ str ( ")" ) ) . as ( :ref )
9597 end
9698
9799 rule ( :keyword ) do
You can’t perform that action at this time.
0 commit comments