Skip to content

Commit

Permalink
refactor(lexer): rename away from reports
Browse files Browse the repository at this point in the history
Summary

Rename `handleReport` to `handleLexerDiag` to differentiate it from the
rest of legacy reports.

Details

Renamed `handleReport` to `handleLexerDiag`, this not only moves away
from 'reports' terminology, but makes it easier to differentiate this
proc from the rest of legacy reports. This is also more consistent with
the `parser.handleParserDiag`.

As part of this change two procs `newlineFollows` and `getIndentWidth`
are no longer exported as they have no public consumers.
  • Loading branch information
saem committed Jul 15, 2023
1 parent 1793ddd commit 0de7802
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions compiler/ast/lexer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ proc getPrecedence*(tok: Token): int =
of tkOr, tkXor, tkPtr, tkRef: result = 3
else: return -10

proc newlineFollows*(L: Lexer): bool =
proc newlineFollows(L: Lexer): bool =
var pos = L.bufpos
while true:
case L.buf[pos]
Expand Down Expand Up @@ -1526,7 +1526,7 @@ proc rawGetTok*(L: var Lexer, tok: var Token) =
inc(L.bufpos)
atTokenEnd()

proc getIndentWidth*(fileIdx: FileIndex, inputstream: PLLStream;
proc getIndentWidth(fileIdx: FileIndex, inputstream: PLLStream;
cache: IdentCache; config: ConfigRef): int =
var lex: Lexer
var tok: Token
Expand Down
4 changes: 2 additions & 2 deletions compiler/ast/parser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ proc getTok(p: var Parser) =
p.lex.rawGetTok(p.tok)

if p.tok.tokType == tkError:
p.lex.config.handleReport(p.tok.error, instLoc(-1), doAbort)
p.lex.config.handleLexerDiag(p.tok.error, instLoc(-1), doAbort)

for d in p.lex.errorsHintsAndWarnings(lexDiagOffset):
p.lex.config.handleReport(d, instLoc(-1))
p.lex.config.handleLexerDiag(d, instLoc(-1))

p.hasProgress = true

Expand Down
2 changes: 1 addition & 1 deletion compiler/front/msgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ func lexerDiagToLegacyReport*(diag: LexerDiag): Report {.inline.} =
msg: diagToHumanStr(diag))
result = Report(category: repLexer, lexReport: rep)

proc handleReport*(
proc handleLexerDiag*(
conf: ConfigRef,
diag: LexerDiag,
reportFrom: InstantiationInfo,
Expand Down

0 comments on commit 0de7802

Please sign in to comment.