diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-04-02 15:21:10 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-04-02 23:41:29 +0200 |
commit | f520dfbfabe1134d92214c66f2e1fcd222053771 (patch) | |
tree | 0f08a0c85075f9db127b51704f959b30d6ad089e /compiler | |
parent | d587b6a25f9976abad9bf4b7039dd0c1f31b2913 (diff) | |
download | Nim-f520dfbfabe1134d92214c66f2e1fcd222053771.tar.gz |
remove en-dash from the language
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/idents.nim | 4 | ||||
-rw-r--r-- | compiler/lexer.nim | 23 |
2 files changed, 6 insertions, 21 deletions
diff --git a/compiler/idents.nim b/compiler/idents.nim index eecfa60a1..2cce4710e 100644 --- a/compiler/idents.nim +++ b/compiler/idents.nim @@ -12,7 +12,7 @@ # id. This module is essential for the compiler's performance. import - hashes, strutils, etcpriv, wordrecg + hashes, strutils, wordrecg type TIdObj* = object of RootObj @@ -45,8 +45,6 @@ proc cmpIgnoreStyle(a, b: cstring, blen: int): int = while j < blen: while a[i] == '_': inc(i) while b[j] == '_': inc(j) - while isMagicIdentSeparatorRune(a, i): inc(i, magicIdentSeparatorRuneByteWidth) - while isMagicIdentSeparatorRune(b, j): inc(j, magicIdentSeparatorRuneByteWidth) # tolower inlined: var aa = a[i] var bb = b[j] diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 2bb228f41..e0875a118 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -17,7 +17,7 @@ import hashes, options, msgs, strutils, platform, idents, nimlexbase, llstream, - wordrecg, etcpriv + wordrecg const MaxLineLength* = 80 # lines longer than this lead to a warning @@ -158,8 +158,6 @@ proc isNimIdentifier*(s: string): bool = while i < sLen: if s[i] == '_': inc(i) - elif isMagicIdentSeparatorRune(cstring s, i): - inc(i, magicIdentSeparatorRuneByteWidth) if s[i] notin SymChars: return inc(i) result = true @@ -782,27 +780,17 @@ proc getSymbol(L: var TLexer, tok: var TToken) = var c = buf[pos] case c of 'a'..'z', '0'..'9', '\x80'..'\xFF': - if c == '\226' and - buf[pos+1] == '\128' and - buf[pos+2] == '\147': # It's a 'magic separator' en-dash Unicode - if buf[pos + magicIdentSeparatorRuneByteWidth] notin SymChars or - isMagicIdentSeparatorRune(buf, pos+magicIdentSeparatorRuneByteWidth) or pos == L.bufpos: - lexMessage(L, errInvalidToken, "–") - break - inc(pos, magicIdentSeparatorRuneByteWidth) - else: - h = h !& ord(c) - inc(pos) + h = h !& ord(c) + inc(pos) of 'A'..'Z': c = chr(ord(c) + (ord('a') - ord('A'))) # toLower() h = h !& ord(c) inc(pos) of '_': - if buf[pos+1] notin SymChars or isMagicIdentSeparatorRune(buf, pos+1): + if buf[pos+1] notin SymChars: lexMessage(L, errInvalidToken, "_") break inc(pos) - else: break tokenEnd(pos-1) h = !$h @@ -1117,8 +1105,7 @@ proc rawGetTok*(L: var TLexer, tok: var TToken) = inc(L.bufpos) of '_': inc(L.bufpos) - if L.buf[L.bufpos] notin SymChars+{'_'} and not - isMagicIdentSeparatorRune(L.buf, L.bufpos): + if L.buf[L.bufpos] notin SymChars+{'_'}: tok.tokType = tkSymbol tok.ident = L.cache.getIdent("_") else: |