From dd81d9d5b711a9a78d5b4a26a62d02da2e495b21 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 19 Jun 2018 09:42:33 +0200 Subject: nimpretty improvements --- compiler/lexer.nim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'compiler/lexer.nim') diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 13460f7c1..c5afa6e97 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -867,7 +867,7 @@ proc getOperator(L: var TLexer, tok: var TToken) = if buf[pos] in {CR, LF, nimlexbase.EndOfFile}: tok.strongSpaceB = -1 -proc newlineFollows*(L: var TLexer): bool = +proc newlineFollows*(L: TLexer): bool = var pos = L.bufpos var buf = L.buf while true: @@ -1220,3 +1220,15 @@ proc rawGetTok*(L: var TLexer, tok: var TToken) = lexMessage(L, errGenerated, "invalid token: " & c & " (\\" & $(ord(c)) & ')') inc(L.bufpos) atTokenEnd() + +proc getIndentWidth*(fileIdx: FileIndex, inputstream: PLLStream; + cache: IdentCache; config: ConfigRef): int = + var lex: TLexer + var tok: TToken + initToken(tok) + openLexer(lex, fileIdx, inputstream, cache, config) + while true: + rawGetTok(lex, tok) + result = tok.indent + if result > 0 or tok.tokType == tkEof: break + closeLexer(lex) -- cgit 1.4.1-2-gfad0 600f3c4bb5'>refs log tree commit diff stats
path: root/examples/htmlrefs.nim
blob: 394932773a8fb09350c21aef5ed82ed724a6b240 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57