made 'shared' a keyword

This commit is contained in:
Araq 2012-11-22 07:53:50 +01:00
commit d0de1fc336
6 changed files with 25 additions and 7 deletions

View file

@ -43,7 +43,7 @@ type
tkLambda, tkLet, tkLambda, tkLet,
tkMacro, tkMethod, tkMixin, tkMod, tkNil, tkNot, tkNotin, tkMacro, tkMethod, tkMixin, tkMod, tkNil, tkNot, tkNotin,
tkObject, tkOf, tkOr, tkOut, tkObject, tkOf, tkOr, tkOut,
tkProc, tkPtr, tkRaise, tkRef, tkReturn, tkShl, tkShr, tkStatic, tkProc, tkPtr, tkRaise, tkRef, tkReturn, tkShared, tkShl, tkShr, tkStatic,
tkTemplate, tkTemplate,
tkTry, tkTuple, tkType, tkVar, tkWhen, tkWhile, tkWith, tkWithout, tkXor, tkTry, tkTuple, tkType, tkVar, tkWhen, tkWhile, tkWith, tkWithout, tkXor,
tkYield, # end of keywords tkYield, # end of keywords
@ -78,7 +78,8 @@ const
"lambda", "let", "lambda", "let",
"macro", "method", "mixin", "mod", "macro", "method", "mixin", "mod",
"nil", "not", "notin", "object", "of", "or", "nil", "not", "notin", "object", "of", "or",
"out", "proc", "ptr", "raise", "ref", "return", "shl", "shr", "static", "out", "proc", "ptr", "raise", "ref", "return",
"shared", "shl", "shr", "static",
"template", "template",
"try", "tuple", "type", "var", "when", "while", "with", "without", "xor", "try", "tuple", "type", "var", "when", "while", "with", "without", "xor",
"yield", "yield",

View file

@ -425,6 +425,8 @@ proc lsub(n: PNode): int =
of nkTypeDef: result = lsons(n) + 3 of nkTypeDef: result = lsons(n) + 3
of nkOfInherit: result = lsub(n.sons[0]) + len("of_") of nkOfInherit: result = lsub(n.sons[0]) + len("of_")
of nkProcTy: result = lsons(n) + len("proc_") of nkProcTy: result = lsons(n) + len("proc_")
of nkIteratorTy: result = lsons(n) + len("iterator_")
of nkSharedTy: result = lsons(n) + len("shared_")
of nkEnumTy: of nkEnumTy:
if sonsLen(n) > 0: if sonsLen(n) > 0:
result = lsub(n.sons[0]) + lcomma(n, 1) + len("enum_") result = lsub(n.sons[0]) + lcomma(n, 1) + len("enum_")
@ -1025,6 +1027,19 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
gsub(g, n.sons[1]) gsub(g, n.sons[1])
else: else:
put(g, tkProc, "proc") put(g, tkProc, "proc")
of nkIteratorTy:
if sonsLen(n) > 0:
putWithSpace(g, tkIterator, "iterator")
gsub(g, n.sons[0])
gsub(g, n.sons[1])
else:
put(g, tkIterator, "iterator")
of nkSharedTy:
if sonsLen(n) > 0:
putWithSpace(g, tkShared, "shared")
gsub(g, n.sons[0])
else:
put(g, tkShared, "shared")
of nkEnumTy: of nkEnumTy:
if sonsLen(n) > 0: if sonsLen(n) > 0:
putWithSpace(g, tkEnum, "enum") putWithSpace(g, tkEnum, "enum")

View file

@ -30,7 +30,7 @@ type
wInclude, wInterface, wIs, wIsnot, wIterator, wLambda, wLet, wInclude, wInterface, wIs, wIsnot, wIterator, wLambda, wLet,
wMacro, wMethod, wMixin, wMod, wNil, wMacro, wMethod, wMixin, wMod, wNil,
wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn, wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn,
wShl, wShr, wStatic, wTemplate, wTry, wTuple, wType, wVar, wShared, wShl, wShr, wStatic, wTemplate, wTry, wTuple, wType, wVar,
wWhen, wWhile, wWith, wWithout, wXor, wYield, wWhen, wWhile, wWith, wWithout, wXor, wYield,
wColon, wColonColon, wEquals, wDot, wDotDot, wColon, wColonColon, wEquals, wDot, wDotDot,
@ -108,7 +108,8 @@ const
"lambda", "let", "lambda", "let",
"macro", "method", "mixin", "mod", "nil", "not", "notin", "macro", "method", "mixin", "mod", "nil", "not", "notin",
"object", "of", "or", "object", "of", "or",
"out", "proc", "ptr", "raise", "ref", "return", "shl", "shr", "static", "out", "proc", "ptr", "raise", "ref", "return",
"shared", "shl", "shr", "static",
"template", "try", "tuple", "type", "var", "template", "try", "tuple", "type", "var",
"when", "while", "with", "without", "xor", "when", "while", "with", "without", "xor",
"yield", "yield",

View file

@ -12,7 +12,7 @@ nil not notin
object of or out object of or out
proc ptr proc ptr
raise ref return raise ref return
shl shr static shared shl shr static
template try tuple type template try tuple type
var var
when while with without when while with without

View file

@ -672,7 +672,7 @@ when false:
add(n, newLeaf(p)) add(n, newLeaf(p))
inc(p.idx) inc(p.idx)
add(father, n) add(father, n)
elif not verbatim and roSupportSmilies in p.shared.options: elif not verbatim and roSupportSmilies in p.sharedState.options:
let n = parseSmiley(p) let n = parseSmiley(p)
if s != nil: if s != nil:
add(father, n) add(father, n)

View file

@ -22,6 +22,7 @@ Library Additions
Changes affecting backwards compatibility Changes affecting backwards compatibility
----------------------------------------- -----------------------------------------
- ``shared`` is a keyword now.
Compiler Additions Compiler Additions