Esempio n. 1
0
        private static IEnumerable <TopLevelStatement> Build(ScLangParser.TopLevelStatementContext context)
        {
            switch (context)
            {
            case ScLangParser.StaticVariableStatementContext c:
                foreach (var decl in Build(c.declaration()))
                {
                    yield return(new StaticVariableStatement(decl, Source(c)));
                }
                break;

            case ScLangParser.ConstantVariableStatementContext c:
                foreach (var decl in Build(c.declaration()))
                {
                    yield return(new ConstantVariableStatement(decl, Source(c)));
                }
                break;

            default:
                yield return(BuildOne(context));

                break;
            }
        }
Esempio n. 2
0
 private static TopLevelStatement BuildOne(ScLangParser.TopLevelStatementContext context)
 => context switch
 {