コード例 #1
0
 private static Parser <SyntaxToken, JassGlobalDeclarationSyntax> GetGlobalDeclarationParser()
 {
     return(Keyword(SyntaxTokenType.ConstantKeyword).Then(Map((type, id, value) => (IVariableDeclarator) new JassVariableDeclaratorSyntax(type, id, value), TypeParser, IdentifierNameParser, EqualsValueClauseParser))
            .Or(VariableDeclaratorParser)
            .Before(Newline.AtLeastOnce())
            .Select(declarator => new JassGlobalDeclarationSyntax(declarator)));
 }
コード例 #2
0
 private static Parser <SyntaxToken, IDeclaration> GetDeclarationParser()
 {
     return(OneOf(
                TypeDeclarationParser,
                GlobalDeclarationListParser,
                NativeFunctionDeclarationParser)
            .Before(Newline.AtLeastOnce()));
 }
コード例 #3
0
 private static Parser <SyntaxToken, IDeclaration> GetGlobalDeclarationListParser()
 {
     return(Keyword(SyntaxTokenType.GlobalsKeyword).Then(Newline.AtLeastOnce()).Then(GlobalDeclarationParser.Many()).Before(Keyword(SyntaxTokenType.EndglobalsKeyword))
            .Select <IDeclaration>(globals => new JassGlobalDeclarationListSyntax(globals.ToImmutableArray())));
 }