added lexer.newlineFollows for parser experiments
This commit is contained in:
parent
5fdc69dfbd
commit
416a322efb
1 changed files with 17 additions and 0 deletions
|
|
@ -860,6 +860,23 @@ proc getOperator(L: var TLexer, tok: var TToken) =
|
||||||
if buf[pos] in {CR, LF, nimlexbase.EndOfFile}:
|
if buf[pos] in {CR, LF, nimlexbase.EndOfFile}:
|
||||||
tok.strongSpaceB = -1
|
tok.strongSpaceB = -1
|
||||||
|
|
||||||
|
proc newlineFollows*(L: var TLexer): bool =
|
||||||
|
var pos = L.bufpos
|
||||||
|
var buf = L.buf
|
||||||
|
while true:
|
||||||
|
case buf[pos]
|
||||||
|
of ' ', '\t':
|
||||||
|
inc(pos)
|
||||||
|
of CR, LF:
|
||||||
|
result = true
|
||||||
|
break
|
||||||
|
of '#':
|
||||||
|
inc(pos)
|
||||||
|
if buf[pos] == '#': inc(pos)
|
||||||
|
if buf[pos] != '[': return true
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
proc skipMultiLineComment(L: var TLexer; tok: var TToken; start: int;
|
proc skipMultiLineComment(L: var TLexer; tok: var TToken; start: int;
|
||||||
isDoc: bool) =
|
isDoc: bool) =
|
||||||
var pos = start
|
var pos = start
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue