diff options
author | Zahary Karadjov <zahary@gmail.com> | 2012-04-18 12:46:02 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2012-04-18 19:50:32 +0300 |
commit | 38710b614f4b34b5c1564e9910a8f275d1ddcce9 (patch) | |
tree | e34bf00a25aef40a481b676db4193718cdfb274e | |
parent | 3d65c0a73f7b645430a94aa3ea99379afae0d97c (diff) | |
download | Nim-38710b614f4b34b5c1564e9910a8f275d1ddcce9.tar.gz |
more Objective-C and C keywords are now escaped
-rwxr-xr-x | compiler/ccgtypes.nim | 6 | ||||
-rwxr-xr-x | compiler/wordrecg.nim | 16 |
2 files changed, 15 insertions, 7 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index a7ad44db6..6082d96e6 100755 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -32,11 +32,11 @@ proc mangle(name: string): string = add(result, "HEX") add(result, toHex(ord(name[i]), 2)) -proc isCKeyword(w: PIdent): bool = +proc isKeyword(w: PIdent): bool = # nimrod and C++ share some keywords # it's more efficient to test the whole nimrod keywords range case w.id - of cppKeywordsLow..cppKeywordsHigh, + of ccgKeywordsLow..ccgKeywordsHigh, nimKeywordsLow..nimKeywordsHigh, ord(wInline): return true else: return false @@ -57,7 +57,7 @@ proc mangleName(s: PSym): PRope = when oKeepVariableNames: let keepOrigName = s.kind in skLocalVars - {skForVar} and {sfFromGeneric, sfGlobal, sfShadowed} * s.flags == {} and - not isCKeyword(s.name) + not isKeyword(s.name) # XXX: This is still very experimental # # Even with all these inefficient checks, the bootstrap diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index 3ae9f7be9..30a6b3c2c 100755 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -43,7 +43,7 @@ type wNosideeffect, wNoreturn, wMerge, wLib, wDynlib, wCompilerproc, wProcVar, wFatal, wError, wWarning, wHint, wLine, wPush, wPop, wDefine, wUndef, wLinedir, wStacktrace, wLinetrace, wLink, wCompile, - wLinksys, wDeprecated, wVarargs, wByref, wCallconv, wBreakpoint, wDebugger, + wLinksys, wDeprecated, wVarargs, wCallconv, wBreakpoint, wDebugger, wNimcall, wStdcall, wCdecl, wSafecall, wSyscall, wInline, wNoInline, wFastcall, wClosure, wNoconv, wOn, wOff, wChecks, wRangechecks, wBoundchecks, wOverflowchecks, wNilchecks, @@ -71,6 +71,10 @@ type wAlignas, wAlignof, wConstexpr, wDecltype, wNullptr, wNoexcept, wThread_local, wStatic_assert, wChar16_t, wChar32_t, + + wStdIn, wStdOut, wStdErr, + + wInOut, wByCopy, wByRef, wOneWay, TSpecialWords* = set[TSpecialWord] @@ -81,8 +85,8 @@ const nimKeywordsLow* = ord(wAsm) nimKeywordsHigh* = ord(wYield) - cppKeywordsLow* = ord(wAuto) - cppKeywordsHigh* = ord(wChar32_t) + ccgKeywordsLow* = ord(wAuto) + ccgKeywordsHigh* = ord(wOneWay) cppNimSharedKeywords* = { wAsm, wBreak, wCase, wConst, wContinue, wDo, wElse, wEnum, wExport, @@ -115,7 +119,7 @@ const "compilerproc", "procvar", "fatal", "error", "warning", "hint", "line", "push", "pop", "define", "undef", "linedir", "stacktrace", "linetrace", "link", "compile", "linksys", "deprecated", "varargs", - "byref", "callconv", "breakpoint", "debugger", "nimcall", "stdcall", + "callconv", "breakpoint", "debugger", "nimcall", "stdcall", "cdecl", "safecall", "syscall", "inline", "noinline", "fastcall", "closure", "noconv", "on", "off", "checks", "rangechecks", "boundchecks", "overflowchecks", "nilchecks", @@ -145,6 +149,10 @@ const "alignas", "alignof", "constexpr", "decltype", "nullptr", "noexcept", "thread_local", "static_assert", "char16_t", "char32_t", + + "stdin", "stdout", "stderr", + + "inout", "bycopy", "byref", "oneway", ] proc findStr*(a: openarray[string], s: string): int = |