protected void Global() { GlobalKeyWords word = LookupKeyWords(); switch (word) { case GlobalKeyWords.None: // jedna se o globalni promennou string type = GetIdent(); SkipWhite(); string name = GetIdent(); SkipWhite(); break; case GlobalKeyWords.Function: Function(PowerObject.Access.Global); break; case GlobalKeyWords.Subroutine: Subroutine(PowerObject.Access.Global); break; default: throw new CompilerException("neocekavane slovo: " + word.ToString()); } }
protected void Type() { GlobalKeyWords word = LookupKeyWords(); switch (word) { case GlobalKeyWords.None: // local type string nestedParent; string obj = GetIdent(); SkipWhite(); Match("from"); SkipWhite(); string baseobj = GetIdent(); if (MatchMayBe('`')) { nestedParent = GetIdent(); baseobj += "." + nestedParent; } SkipWhite(); if (MatchMayBe("within ")) { SkipWhite(); string parent = GetIdent(); SkipWhite(); powerScriptHolder.CreateUnresolvedLocalType(obj, baseobj, parent); } else { powerScriptHolder.CreateUnresolvedLocalType(obj, baseobj); } SkipLines("end type"); break; case GlobalKeyWords.Variables: SkipWhite(); SkipLines("end variables"); break; case GlobalKeyWords.TypePrototypes: SkipWhite(); SkipLines("end prototypes"); break; } }
protected void ParameterList() { string type; string name; Argument.PassingType pass; do { SkipWhite(); GlobalKeyWords word = LookupKeyWords(); switch (word) { case GlobalKeyWords.None: pass = Argument.PassingType.Value; break; case GlobalKeyWords.Readonly: pass = Argument.PassingType.Readonly; SkipWhite(); break; case GlobalKeyWords.Ref: pass = Argument.PassingType.Ref; SkipWhite(); break; default: throw new CompilerException("Nepovolene klicove slovo: " + word.ToString()); } SkipWhite(); type = GetIdent(); SkipWhite(); name = GetIdent(); if (MatchMayBe('[')) { // jedna se o pole string range; if (!Peek(']')) { range = GetNumber(); } Match(']'); name = name; } SkipWhite(); powerScriptHolder.CreateArgument(name, type, pass); } while(MatchMayBe(',')); }
protected void AccessModifier(PowerObject.Access access) { SkipWhite(); GlobalKeyWords word = LookupKeyWords(); SkipWhite(); switch (word) { case GlobalKeyWords.Function: Function(access); break; case GlobalKeyWords.Subroutine: Subroutine(access); break; } }