diff --git a/examples/MetaCode/example3.mc b/examples/MetaCode/example3.mc index f0a47a3..66bd0d7 100644 --- a/examples/MetaCode/example3.mc +++ b/examples/MetaCode/example3.mc @@ -1,3 +1,5 @@ +attribute @extends(name: string); + // az objektumtípusok közötti öröklődést fogjuk szimulálni a makróval macro ExtendsMacro(trees: { * > type > attribute[name=extends] }) do foreach (var tree : any in trees) do @@ -44,3 +46,6 @@ end; + + + diff --git a/examples/MetaCode/example5.mc b/examples/MetaCode/example5.mc index f812af5..b891b63 100644 --- a/examples/MetaCode/example5.mc +++ b/examples/MetaCode/example5.mc @@ -10,30 +10,20 @@ macro ObjectType(person: { * > type[name=Person] }) do foreach (var member : any in members(person)) do // a name adattag típusát megváltoztatjuk any-ra // a change függvénnyel + // az equals ebben az esetben egy speciláis függvény, + // ugyanis a name(...) egy listával tér vissza, és abban + // keresi a 'name' sztringliterált if (equals(name(member), 'name')) // az első paraméterrel mondjuk meg, hogy mit szeretnénk megváltoztatni // a másodikkal, hogy mely objektumnak akarjuk megváltoztatni // a harmadikkal pedig megmondjuk, hogy milyen típusú lesz - change('type', type(member), 'any'); + change('type', type(member), 'string'); end; end; debug(person); end; object Person - name: string; + name: __missing__type__; age: number; end; - -@extends(Person) -object Employee - company: string; -end; - - - - - - - - diff --git a/install/setup.exe b/install/setup.exe new file mode 100644 index 0000000..e54f707 Binary files /dev/null and b/install/setup.exe differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml b/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml index 04eb1c0..6cc8d2f 100644 --- a/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml +++ b/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:avalon="http://icsharpcode.net/sharpdevelop/avalonedit" xmlns:views="clr-namespace:MetaCode.CodeVisualizer.Views" - Title="MetaCode" + Title="MetaCode IDE" Height="350" Width="525"> @@ -11,17 +11,12 @@ - + Click="NewFileCommand" /> diff --git a/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml.cs b/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml.cs index e4743c7..8f4b5eb 100644 --- a/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml.cs +++ b/project/MetaCode/MetaCode.CodeVisualizer/MainWindow.xaml.cs @@ -47,6 +47,7 @@ private void OpenFileCommand(object sender, RoutedEventArgs e) if (dialog.ShowDialog(this) == true) { var file = dialog.FileName; + this.Title = "MetaCode IDE - " + file; using (var text = File.OpenText(file)) { ViewModel.OriginalSourceCode = text.ReadToEnd(); } diff --git a/project/MetaCode/MetaCode.CodeVisualizer/ViewModels/MainViewModel.cs b/project/MetaCode/MetaCode.CodeVisualizer/ViewModels/MainViewModel.cs index d20a842..b20df3d 100644 --- a/project/MetaCode/MetaCode.CodeVisualizer/ViewModels/MainViewModel.cs +++ b/project/MetaCode/MetaCode.CodeVisualizer/ViewModels/MainViewModel.cs @@ -37,6 +37,7 @@ public class MainViewModel : ViewModelBase private string _output; private ActionCommand _clearOutputCommand; private ObservableCollection _messages; + private string _windowTitle; private Node ParseWithAbstractTreeVisitor(MetaCodeCompiler compiler, string source) { @@ -71,6 +72,7 @@ private void InitializeCompiler() SemanticParser = new SemanticParser(CompilerService); InitializeFunctions(); + WindowTitle = "MetaCode IDE"; } private void InitializeFunctions() @@ -135,6 +137,16 @@ public ActionCommand ClearOutputCommand } } + public string WindowTitle + { + get { return _windowTitle; } + set + { + _windowTitle = value; + OnPropertyChanged(() => WindowTitle); + } + } + public ObservableCollection Messages { get { return _messages; } diff --git a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.exe b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.exe index 742bd09..c793f9c 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.exe and b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.exe differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.pdb b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.pdb index cb8de67..f5299ad 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.pdb and b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.CodeVisualizer.pdb differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.dll b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.dll index e10215f..c1b9ff8 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.dll and b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.dll differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.pdb b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.pdb index 535c28c..9feac2e 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.pdb and b/project/MetaCode/MetaCode.CodeVisualizer/bin/Debug/MetaCode.Compiler.pdb differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.baml b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.baml index 732ef67..8340456 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.baml and b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.baml differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.cs b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.cs index 8c53764..8a0d40a 100644 --- a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.cs +++ b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "05E6509B5E4D08265A477607D9676ECB" +#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "2990525AA4D8B30FFCEA9B52F3E9C161" //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -84,7 +84,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object { case 1: - #line 15 "..\..\MainWindow.xaml" + #line 14 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.NewFileCommand); #line default @@ -92,7 +92,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 2: - #line 19 "..\..\MainWindow.xaml" + #line 16 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OpenFileCommand); #line default @@ -100,7 +100,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 3: - #line 22 "..\..\MainWindow.xaml" + #line 18 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveFileCommand); #line default @@ -108,7 +108,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 4: - #line 25 "..\..\MainWindow.xaml" + #line 20 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveGeneratedFileCommand); #line default @@ -116,7 +116,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 5: - #line 27 "..\..\MainWindow.xaml" + #line 22 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.CloseWindowCommand); #line default diff --git a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.i.cs b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.i.cs index 8c53764..8a0d40a 100644 --- a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.i.cs +++ b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MainWindow.g.i.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "05E6509B5E4D08265A477607D9676ECB" +#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "2990525AA4D8B30FFCEA9B52F3E9C161" //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -84,7 +84,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object { case 1: - #line 15 "..\..\MainWindow.xaml" + #line 14 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.NewFileCommand); #line default @@ -92,7 +92,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 2: - #line 19 "..\..\MainWindow.xaml" + #line 16 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OpenFileCommand); #line default @@ -100,7 +100,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 3: - #line 22 "..\..\MainWindow.xaml" + #line 18 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveFileCommand); #line default @@ -108,7 +108,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 4: - #line 25 "..\..\MainWindow.xaml" + #line 20 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveGeneratedFileCommand); #line default @@ -116,7 +116,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object return; case 5: - #line 27 "..\..\MainWindow.xaml" + #line 22 "..\..\MainWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.CloseWindowCommand); #line default diff --git a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.csprojResolveAssemblyReference.cache b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.csprojResolveAssemblyReference.cache index e789a3e..fe9b080 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.csprojResolveAssemblyReference.cache and b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.csprojResolveAssemblyReference.cache differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.exe b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.exe index 742bd09..c793f9c 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.exe and b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.exe differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.g.resources b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.g.resources index a1a26c9..a27b5f8 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.g.resources and b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.g.resources differ diff --git a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.pdb b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.pdb index cb8de67..f5299ad 100644 Binary files a/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.pdb and b/project/MetaCode/MetaCode.CodeVisualizer/obj/Debug/MetaCode.CodeVisualizer.pdb differ diff --git a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.dll b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.dll index 39eb08f..575d650 100644 Binary files a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.dll and b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.dll differ diff --git a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.pdb b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.pdb index c86d5d4..4901f5b 100644 Binary files a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.pdb and b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.Tests.pdb differ diff --git a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.dll b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.dll index c6d374d..e10215f 100644 Binary files a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.dll and b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.dll differ diff --git a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.pdb b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.pdb index 4468a6d..535c28c 100644 Binary files a/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.pdb and b/project/MetaCode/MetaCode.Compiler.Tests/bin/Debug/MetaCode.Compiler.pdb differ diff --git a/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.csprojResolveAssemblyReference.cache b/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.csprojResolveAssemblyReference.cache index 4d67b7b..41778c3 100644 Binary files a/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.csprojResolveAssemblyReference.cache and b/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.csprojResolveAssemblyReference.cache differ diff --git a/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.dll b/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.dll index 39eb08f..575d650 100644 Binary files a/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.dll and b/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.dll differ diff --git a/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.pdb b/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.pdb index c86d5d4..4901f5b 100644 Binary files a/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.pdb and b/project/MetaCode/MetaCode.Compiler.Tests/obj/Debug/MetaCode.Compiler.Tests.pdb differ diff --git a/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/CodeGenerator.cs b/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/CodeGenerator.cs index 67e52b9..c8bbf5f 100644 --- a/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/CodeGenerator.cs +++ b/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/CodeGenerator.cs @@ -34,7 +34,8 @@ private void Initialize() this .DefaultVisitor( (visitor, node) => string.Join("", node.Children.Select(visitor.VisitChild)).ToCodeBuilder()) - .If((visitor, node) => { + .If((visitor, node) => + { _codeBuilder = new CodeBuilder() .Clear() .AppendLine("// Generated code by compiler after AST transformation") @@ -49,7 +50,8 @@ private void Initialize() .If((visitor, node) => _codeBuilder.Append(node.Name)) .If((_, node) => _codeBuilder.Append(node.Type)) .If((visitor, node) => _codeBuilder.Append(string.Join(".", node.Members.Select(member => member.Name)))) - .If((visitor, node) => { + .If((visitor, node) => + { visitor.VisitChild(node.FunctionName); _codeBuilder.Append("("); JoinByComma(node.ActualParameters, visitor); @@ -61,14 +63,16 @@ private void Initialize() .If((visitor, node) => _codeBuilder.Append(node.Value.ToString().ToLowerInvariant())) .If((visitor, node) => _codeBuilder.Append("null")) .If((visitor, node) => _codeBuilder.Append(string.Format("'{0}'", node.Value))) - .If((visitor, node) => { + .If((visitor, node) => + { _codeBuilder.Append("["); JoinByComma(node.Value, visitor); _codeBuilder.Append("]"); return _codeBuilder; }) .If((visitor, node) => visitor.VisitChild(node.Expression).Append(";" + Environment.NewLine)) - .If((visitor, node) => { + .If((visitor, node) => + { _codeBuilder.Append("("); visitor.VisitChild(node.Expression); _codeBuilder.Append(")"); @@ -76,14 +80,16 @@ private void Initialize() }) .If((visitor, node) => _codeBuilder.Append(node.Operator.Operator) .Do(() => visitor.VisitChild(node.Expression))) - .If((visitor, node) => { + .If((visitor, node) => + { return visitor.VisitChild(node.Left) .Append(" ") .Append(node.Operator.Operator) .Append(" ") .Do(() => visitor.VisitChild(node.Right)); }) - .If((visitor, node) => { + .If((visitor, node) => + { return _codeBuilder.Append("var ") .Do(() => visitor.VisitChild(node.Identifier)) .Append(" : ") @@ -92,13 +98,16 @@ private void Initialize() .Do(() => visitor.VisitChild(node.InitialValue)) .AppendLine(";"); }) - .If((visitor, node) => { + .If((visitor, node) => + { return _codeBuilder.Append("object ") .Do(() => visitor.VisitChild(node.Identifier)) .AppendLine() .RaiseIndentation() - .Do(() => { - foreach (var child in node.Parameters) { + .Do(() => + { + foreach (var child in node.Parameters) + { _codeBuilder.ApplyIndentation(); visitor.VisitChild(child); _codeBuilder.AppendLine(";"); @@ -108,19 +117,24 @@ private void Initialize() .AppendLine("end;"); }) .If((visitor, node) => _codeBuilder) - .If((visitor, node) => { - return _codeBuilder.Append("attribute ") + .If((visitor, node) => + { + /*return _codeBuilder.Append("attribute ") .Do(() => visitor.VisitChild(node.Identifier)) .Append("(") .Do(() => JoinByComma(node.Parameters, visitor)) - .AppendLine(");"); + .AppendLine(");");*/ + + return _codeBuilder; }) - .If((visitor, node) => { + .If((visitor, node) => + { return _codeBuilder.Append(node.Name) .Append(": ") .Do(() => visitor.VisitChild(node.TypeName)); }) - .If((visitor, node) => { + .If((visitor, node) => + { _codeBuilder.Append("function ") .Do(() => visitor.VisitChild(node.Identifier)) .Append("(") @@ -129,8 +143,10 @@ private void Initialize() .Do(() => visitor.VisitChild(node.ReturnType)) .AppendLine(" do ") .RaiseIndentation() - .Do(() => { - foreach (var statement in node.FunctionBody.Statements) { + .Do(() => + { + foreach (var statement in node.FunctionBody.Statements) + { _codeBuilder.ApplyIndentation(); visitor.VisitChild(statement); } @@ -145,7 +161,8 @@ private void Initialize() .If((visitor, node) => visitor.VisitChild(node.LeftValue) .Append(" = ") .Do(() => visitor.VisitChild(node.RightValue))) - .If((visitor, node) => { + .If((visitor, node) => + { return _codeBuilder.Append("while") .Append(" (") .Do(() => visitor.VisitChild(node.ConditionExpression)) @@ -153,7 +170,8 @@ private void Initialize() .Do(() => visitor.VisitChild(node.Body)); }) - .If((visitor, node) => { + .If((visitor, node) => + { return _codeBuilder.Append("foreach") .Append(" (var ") .Do(() => visitor.VisitChild(node.LoopVariable)) @@ -164,12 +182,15 @@ private void Initialize() .Append(") ") .Do(() => visitor.VisitChild(node.Body)); }) - .If((visitor, node) => { + .If((visitor, node) => + { return _codeBuilder.Append("do") .AppendLine() .RaiseIndentation() - .Do(() => { - foreach (var statement in node.Statements) { + .Do(() => + { + foreach (var statement in node.Statements) + { _codeBuilder.ApplyIndentation(); visitor.VisitChild(statement); } @@ -178,27 +199,33 @@ private void Initialize() .ApplyIndentation() .AppendLine("end;"); }) - .If((visitor, node) => { + .If((visitor, node) => + { _codeBuilder.Append("if ") .Append("(") .Do(() => visitor.VisitChild(node.ConditionExpression)) .AppendLine(")") .RaiseIndentation() - .Do(() => { - foreach (var child in node.TrueStatementNode.Statements) { + .Do(() => + { + foreach (var child in node.TrueStatementNode.Statements) + { _codeBuilder.ApplyIndentation(); visitor.VisitChild(child); } }) .ReduceIndentation(); - if (node.FalseStatementNode.Statements.Any()) { + if (node.FalseStatementNode.Statements.Any()) + { _codeBuilder .ApplyIndentation() .AppendLine("else") .RaiseIndentation() - .Do(() => { - foreach (var child in node.FalseStatementNode.Statements) { + .Do(() => + { + foreach (var child in node.FalseStatementNode.Statements) + { _codeBuilder.ApplyIndentation(); visitor.VisitChild(child); } @@ -229,8 +256,10 @@ private void JoinByComma(IEnumerable collection, TreeVisitorBase(string separator, IEnumerable collection, TreeVisitorBase visitor) where TNode : Node { - if (collection.Any()) { - foreach (var item in collection.Take(collection.Count() - 1)) { + if (collection.Any()) + { + foreach (var item in collection.Take(collection.Count() - 1)) + { _codeBuilder.Do(() => visitor.VisitChild(item)) .Append(separator); } diff --git a/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/MacroInterpreter.cs b/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/MacroInterpreter.cs index ba7ab83..30840f1 100644 --- a/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/MacroInterpreter.cs +++ b/project/MetaCode/MetaCode.Compiler/AbstractSyntaxTree/Visitors/MacroInterpreter.cs @@ -43,6 +43,31 @@ public class MacroInterpreter : TreeVisitorBase public CompilationUnit Root { get; protected set; } + public Dictionary StandardTypes { get; set; } + + private void InitializeStandardTypes() + { + StandardTypes = new Dictionary(); + + StandardTypes.Add("number", typeof(Double)); + StandardTypes.Add("any", typeof(Object)); + StandardTypes.Add("string", typeof(String)); + StandardTypes.Add("boolean", typeof(Boolean)); + StandardTypes.Add("array", typeof(IEnumerable)); + } + + private Type FindType(string name) + { + Type result; + if (StandardTypes.TryGetValue(name, out result)) + return result; + + if (CompilerService.GetScope().FindType(name) != null) + return typeof(ObjectType); + + return null; + } + public MacroInterpreter(CompilerService compilerService) { if (compilerService == null) @@ -58,6 +83,7 @@ public MacroInterpreter(CompilerService compilerService) Initialize(); InitializeNativeFunctions(); + InitializeStandardTypes(); } private void InitializeNativeFunctions() @@ -464,11 +490,24 @@ private void Initialize() var attributes = ((ISupportAttributes)child).Attributes; foreach (var attribute in attributes.Where(attr => attr != null)) { - if (!_attributes.Any(attr => attr.AttributeName == attribute.Name)) + var attributeDecl = + _attributes.FirstOrDefault(attr => attr.AttributeName == attribute.Name); + + if (attributeDecl == null) { CompilerService.Error(string.Format("Unrecognized attribute: {0}!", attribute.Name)); break; } + + var expressionAnalyzer = new ExpressionTypeAnalyzer(CompilerService); + var expressions = attribute.Expressions.ToArray(); + for (var i = 0; i < expressions.Length; i++) + { + var expression = expressions[i]; + var type = expressionAnalyzer.VisitChild(expression); + if (!FindType(attributeDecl.Parameters[i].TypeName.Type).IsAssignableFrom(type)) + CompilerService.Error(string.Format("Invalid argument of attribute: {0}", attribute.Name)); + } } } visitor.VisitChild(child); diff --git a/project/MetaCode/MetaCode.Compiler/Selectors/ObjectSelector.cs b/project/MetaCode/MetaCode.Compiler/Selectors/ObjectSelector.cs new file mode 100644 index 0000000..6afc642 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/Selectors/ObjectSelector.cs @@ -0,0 +1,23 @@ +using System; +using MetaCode.Compiler.AbstractSyntaxTree; +using MetaCode.Compiler.AbstractSyntaxTree.Statements; + +namespace MetaCode.Compiler.Selectors +{ + public class ObjectSelector : NodeSelector + { + protected override bool FilterNode(Node node) + { + var filter = new Func(() => node is ObjectDeclarationStatementNode); + + TryGetAttribute("name", attribute => + { + var result = filter(); + var objectNode = node as ObjectDeclarationStatementNode; + filter = () => result && objectNode.ObjectName == attribute.Value; + }); + + return filter(); + } + } +} \ No newline at end of file diff --git a/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.dll b/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.dll index e10215f..c1b9ff8 100644 Binary files a/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.dll and b/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.dll differ diff --git a/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.pdb b/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.pdb index 535c28c..9feac2e 100644 Binary files a/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.pdb and b/project/MetaCode/MetaCode.Compiler/bin/Debug/MetaCode.Compiler.pdb differ diff --git a/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.dll b/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.dll index e10215f..c1b9ff8 100644 Binary files a/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.dll and b/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.dll differ diff --git a/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.pdb b/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.pdb index 535c28c..9feac2e 100644 Binary files a/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.pdb and b/project/MetaCode/MetaCode.Compiler/obj/Debug/MetaCode.Compiler.pdb differ diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeBaseListener.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeBaseListener.cs new file mode 100644 index 0000000..338f1ae --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeBaseListener.cs @@ -0,0 +1,491 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\MetaCode.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { + +using Antlr4.Runtime.Misc; +using IErrorNode = Antlr4.Runtime.Tree.IErrorNode; +using ITerminalNode = Antlr4.Runtime.Tree.ITerminalNode; +using IToken = Antlr4.Runtime.IToken; +using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; + +/// +/// This class provides an empty implementation of , +/// which can be extended to create a listener which only needs to handle a subset +/// of the available methods. +/// +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class MetaCodeBaseListener : IMetaCodeListener { + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterExpression([NotNull] MetaCodeParser.ExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitExpression([NotNull] MetaCodeParser.ExpressionContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterFormalParameter([NotNull] MetaCodeParser.FormalParameterContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitFormalParameter([NotNull] MetaCodeParser.FormalParameterContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterReturnStatement([NotNull] MetaCodeParser.ReturnStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitReturnStatement([NotNull] MetaCodeParser.ReturnStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterAttribute([NotNull] MetaCodeParser.AttributeContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitAttribute([NotNull] MetaCodeParser.AttributeContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterBlockStatement([NotNull] MetaCodeParser.BlockStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitBlockStatement([NotNull] MetaCodeParser.BlockStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterIntervalConstant([NotNull] MetaCodeParser.IntervalConstantContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitIntervalConstant([NotNull] MetaCodeParser.IntervalConstantContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterPrimaryExpression([NotNull] MetaCodeParser.PrimaryExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitPrimaryExpression([NotNull] MetaCodeParser.PrimaryExpressionContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterMacroCallExpression([NotNull] MetaCodeParser.MacroCallExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitMacroCallExpression([NotNull] MetaCodeParser.MacroCallExpressionContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterAttributeDeclaration([NotNull] MetaCodeParser.AttributeDeclarationContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitAttributeDeclaration([NotNull] MetaCodeParser.AttributeDeclarationContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterElseIfStatement([NotNull] MetaCodeParser.ElseIfStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitElseIfStatement([NotNull] MetaCodeParser.ElseIfStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterVariableDeclaration([NotNull] MetaCodeParser.VariableDeclarationContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitVariableDeclaration([NotNull] MetaCodeParser.VariableDeclarationContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterFunctionStatement([NotNull] MetaCodeParser.FunctionStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitFunctionStatement([NotNull] MetaCodeParser.FunctionStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterStatements([NotNull] MetaCodeParser.StatementsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitStatements([NotNull] MetaCodeParser.StatementsContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterMacroFormalParameter([NotNull] MetaCodeParser.MacroFormalParameterContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitMacroFormalParameter([NotNull] MetaCodeParser.MacroFormalParameterContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterActualParameterList([NotNull] MetaCodeParser.ActualParameterListContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitActualParameterList([NotNull] MetaCodeParser.ActualParameterListContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterSkipStatement([NotNull] MetaCodeParser.SkipStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitSkipStatement([NotNull] MetaCodeParser.SkipStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterConstant([NotNull] MetaCodeParser.ConstantContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitConstant([NotNull] MetaCodeParser.ConstantContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterBooleanConstant([NotNull] MetaCodeParser.BooleanConstantContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitBooleanConstant([NotNull] MetaCodeParser.BooleanConstantContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterMemberTagExpression([NotNull] MetaCodeParser.MemberTagExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitMemberTagExpression([NotNull] MetaCodeParser.MemberTagExpressionContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterAssignmentExpression([NotNull] MetaCodeParser.AssignmentExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitAssignmentExpression([NotNull] MetaCodeParser.AssignmentExpressionContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInit([NotNull] MetaCodeParser.InitContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInit([NotNull] MetaCodeParser.InitContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterNumberConstant([NotNull] MetaCodeParser.NumberConstantContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitNumberConstant([NotNull] MetaCodeParser.NumberConstantContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterIfStatement([NotNull] MetaCodeParser.IfStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitIfStatement([NotNull] MetaCodeParser.IfStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterTypeName([NotNull] MetaCodeParser.TypeNameContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitTypeName([NotNull] MetaCodeParser.TypeNameContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterMemberExpression([NotNull] MetaCodeParser.MemberExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitMemberExpression([NotNull] MetaCodeParser.MemberExpressionContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterObjectDeclaration([NotNull] MetaCodeParser.ObjectDeclarationContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitObjectDeclaration([NotNull] MetaCodeParser.ObjectDeclarationContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterStatement([NotNull] MetaCodeParser.StatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitStatement([NotNull] MetaCodeParser.StatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterWhileStatement([NotNull] MetaCodeParser.WhileStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitWhileStatement([NotNull] MetaCodeParser.WhileStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterMacroStatement([NotNull] MetaCodeParser.MacroStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitMacroStatement([NotNull] MetaCodeParser.MacroStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterFunctionCallExpression([NotNull] MetaCodeParser.FunctionCallExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitFunctionCallExpression([NotNull] MetaCodeParser.FunctionCallExpressionContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterArrayConstant([NotNull] MetaCodeParser.ArrayConstantContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitArrayConstant([NotNull] MetaCodeParser.ArrayConstantContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterForeachStatement([NotNull] MetaCodeParser.ForeachStatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitForeachStatement([NotNull] MetaCodeParser.ForeachStatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterStringConstant([NotNull] MetaCodeParser.StringConstantContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitStringConstant([NotNull] MetaCodeParser.StringConstantContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterIdentifier([NotNull] MetaCodeParser.IdentifierContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitIdentifier([NotNull] MetaCodeParser.IdentifierContext context) { } + + /// + /// The default implementation does nothing. + public virtual void EnterEveryRule([NotNull] ParserRuleContext context) { } + /// + /// The default implementation does nothing. + public virtual void ExitEveryRule([NotNull] ParserRuleContext context) { } + /// + /// The default implementation does nothing. + public virtual void VisitTerminal([NotNull] ITerminalNode node) { } + /// + /// The default implementation does nothing. + public virtual void VisitErrorNode([NotNull] IErrorNode node) { } +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeBaseVisitor.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeBaseVisitor.cs new file mode 100644 index 0000000..5cad6d1 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeBaseVisitor.cs @@ -0,0 +1,409 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\MetaCode.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using IToken = Antlr4.Runtime.IToken; +using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; + +/// +/// This class provides an empty implementation of , +/// which can be extended to create a visitor which only needs to handle a subset +/// of the available methods. +/// +/// The return type of the visit operation. +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class MetaCodeBaseVisitor : AbstractParseTreeVisitor, IMetaCodeVisitor { + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitExpression([NotNull] MetaCodeParser.ExpressionContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitFormalParameter([NotNull] MetaCodeParser.FormalParameterContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitReturnStatement([NotNull] MetaCodeParser.ReturnStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAttribute([NotNull] MetaCodeParser.AttributeContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitBlockStatement([NotNull] MetaCodeParser.BlockStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitIntervalConstant([NotNull] MetaCodeParser.IntervalConstantContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitPrimaryExpression([NotNull] MetaCodeParser.PrimaryExpressionContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMacroCallExpression([NotNull] MetaCodeParser.MacroCallExpressionContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAttributeDeclaration([NotNull] MetaCodeParser.AttributeDeclarationContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitElseIfStatement([NotNull] MetaCodeParser.ElseIfStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitVariableDeclaration([NotNull] MetaCodeParser.VariableDeclarationContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitFunctionStatement([NotNull] MetaCodeParser.FunctionStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitStatements([NotNull] MetaCodeParser.StatementsContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMacroFormalParameter([NotNull] MetaCodeParser.MacroFormalParameterContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitActualParameterList([NotNull] MetaCodeParser.ActualParameterListContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSkipStatement([NotNull] MetaCodeParser.SkipStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitConstant([NotNull] MetaCodeParser.ConstantContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitBooleanConstant([NotNull] MetaCodeParser.BooleanConstantContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMemberTagExpression([NotNull] MetaCodeParser.MemberTagExpressionContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAssignmentExpression([NotNull] MetaCodeParser.AssignmentExpressionContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInit([NotNull] MetaCodeParser.InitContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitNumberConstant([NotNull] MetaCodeParser.NumberConstantContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitIfStatement([NotNull] MetaCodeParser.IfStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitTypeName([NotNull] MetaCodeParser.TypeNameContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMemberExpression([NotNull] MetaCodeParser.MemberExpressionContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitObjectDeclaration([NotNull] MetaCodeParser.ObjectDeclarationContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitStatement([NotNull] MetaCodeParser.StatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitWhileStatement([NotNull] MetaCodeParser.WhileStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMacroStatement([NotNull] MetaCodeParser.MacroStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitFunctionCallExpression([NotNull] MetaCodeParser.FunctionCallExpressionContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitArrayConstant([NotNull] MetaCodeParser.ArrayConstantContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitForeachStatement([NotNull] MetaCodeParser.ForeachStatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitStringConstant([NotNull] MetaCodeParser.StringConstantContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitIdentifier([NotNull] MetaCodeParser.IdentifierContext context) { return VisitChildren(context); } +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeLexer.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeLexer.cs new file mode 100644 index 0000000..3e95110 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeLexer.cs @@ -0,0 +1,244 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\MetaCode.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime; +using Antlr4.Runtime.Atn; +using Antlr4.Runtime.Misc; +using DFA = Antlr4.Runtime.Dfa.DFA; + +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class MetaCodeLexer : Lexer { + public const int + T__19=1, T__18=2, T__17=3, T__16=4, T__15=5, T__14=6, T__13=7, T__12=8, + T__11=9, T__10=10, T__9=11, T__8=12, T__7=13, T__6=14, T__5=15, T__4=16, + T__3=17, T__2=18, T__1=19, T__0=20, FUNCTION=21, FOREACH=22, WHILE=23, + IF=24, ELSE=25, DO=26, END=27, BOOLEAN=28, IMPLICIT=29, EXPLICIT=30, MACRO=31, + SKIP=32, VAR=33, IN=34, ASSIGN=35, AND=36, OR=37, NOT=38, NULL=39, RETURN=40, + LEFT_PARENTHESIS=41, RIGHT_PARENTHESIS=42, ID=43, COMMENT=44, MULTILINE_COMMENT=45, + TREE_SELECTOR=46, ATTRIBUTE_ID=47, STRING=48, NUMBER=49, WHITESPACE=50, + NEWLINE=51; + public static string[] modeNames = { + "DEFAULT_MODE" + }; + + public static readonly string[] tokenNames = { + "", + "']'", "'.'", "','", "'+'", "'*'", "'-'", "'attribute'", "'['", "':'", + "'<'", "'object'", "'!='", "';'", "'<='", "'to'", "'>'", "'by'", "'/'", + "'=='", "'>='", "'function'", "'foreach'", "'while'", "'if'", "'else'", + "'do'", "'end'", "BOOLEAN", "'implicit'", "'explicit'", "'macro'", "'skip'", + "'var'", "'in'", "'='", "'and'", "'or'", "'not'", "'null'", "'return'", + "'('", "')'", "ID", "COMMENT", "MULTILINE_COMMENT", "TREE_SELECTOR", "ATTRIBUTE_ID", + "STRING", "NUMBER", "WHITESPACE", "NEWLINE" + }; + public static readonly string[] ruleNames = { + "T__19", "T__18", "T__17", "T__16", "T__15", "T__14", "T__13", "T__12", + "T__11", "T__10", "T__9", "T__8", "T__7", "T__6", "T__5", "T__4", "T__3", + "T__2", "T__1", "T__0", "FUNCTION", "FOREACH", "WHILE", "IF", "ELSE", + "DO", "END", "BOOLEAN", "IMPLICIT", "EXPLICIT", "MACRO", "SKIP", "VAR", + "IN", "ASSIGN", "AND", "OR", "NOT", "NULL", "RETURN", "LEFT_PARENTHESIS", + "RIGHT_PARENTHESIS", "ID", "COMMENT", "MULTILINE_COMMENT", "TREE_SELECTOR", + "ATTRIBUTE_ID", "LETTER", "STRING", "NUMBER", "INT", "FLOAT", "DIGIT", + "WHITESPACE", "NEWLINE" + }; + + + public MetaCodeLexer(ICharStream input) + : base(input) + { + _interp = new LexerATNSimulator(this,_ATN); + } + + public override string GrammarFileName { get { return "MetaCode.g4"; } } + + public override string[] TokenNames { get { return tokenNames; } } + + public override string[] RuleNames { get { return ruleNames; } } + + public override string[] ModeNames { get { return modeNames; } } + + public override string SerializedAtn { get { return _serializedATN; } } + + public static readonly string _serializedATN = + "\x3\xAF6F\x8320\x479D\xB75C\x4880\x1605\x191C\xAB37\x2\x35\x199\b\x1\x4"+ + "\x2\t\x2\x4\x3\t\x3\x4\x4\t\x4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x33\x3\x34\x6\x34\x172"+ + "\n\x34\r\x34\xE\x34\x173\x3\x35\x6\x35\x177\n\x35\r\x35\xE\x35\x178\x3"+ + "\x35\x3\x35\a\x35\x17D\n\x35\f\x35\xE\x35\x180\v\x35\x3\x35\x3\x35\x6"+ + "\x35\x184\n\x35\r\x35\xE\x35\x185\x5\x35\x188\n\x35\x3\x36\x3\x36\x3\x37"+ + "\x6\x37\x18D\n\x37\r\x37\xE\x37\x18E\x3\x37\x3\x37\x3\x38\x5\x38\x194"+ + "\n\x38\x3\x38\x3\x38\x3\x38\x3\x38\a\x12F\x13C\x148\x15E\x166\x2\x2\x39"+ + "\x3\x2\x3\x5\x2\x4\a\x2\x5\t\x2\x6\v\x2\a\r\x2\b\xF\x2\t\x11\x2\n\x13"+ + "\x2\v\x15\x2\f\x17\x2\r\x19\x2\xE\x1B\x2\xF\x1D\x2\x10\x1F\x2\x11!\x2"+ + "\x12#\x2\x13%\x2\x14\'\x2\x15)\x2\x16+\x2\x17-\x2\x18/\x2\x19\x31\x2\x1A"+ + "\x33\x2\x1B\x35\x2\x1C\x37\x2\x1D\x39\x2\x1E;\x2\x1F=\x2 ?\x2!\x41\x2"+ + "\"\x43\x2#\x45\x2$G\x2%I\x2&K\x2\'M\x2(O\x2)Q\x2*S\x2+U\x2,W\x2-Y\x2."+ + "[\x2/]\x2\x30_\x2\x31\x61\x2\x2\x63\x2\x32\x65\x2\x33g\x2\x2i\x2\x2k\x2"+ + "\x2m\x2\x34o\x2\x35\x3\x2\a\x4\x2\x32;\x61\x61\x5\x2//\x32;\x61\x61\x4"+ + "\x2\x43\\\x63|\x3\x2\x32;\x4\x2\v\v\"\"\x1A9\x2\x3\x3\x2\x2\x2\x2\x5\x3"+ + "\x2\x2\x2\x2\a\x3\x2\x2\x2\x2\t\x3\x2\x2\x2\x2\v\x3\x2\x2\x2\x2\r\x3\x2"+ + "\x2\x2\x2\xF\x3\x2\x2\x2\x2\x11\x3\x2\x2\x2\x2\x13\x3\x2\x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\xF1\xF2\a\x65\x2\x2\xF2\xF3\at\x2\x2\xF3"+ + "\xF4\aq\x2\x2\xF4@\x3\x2\x2\x2\xF5\xF6\au\x2\x2\xF6\xF7\am\x2\x2\xF7\xF8"+ + "\ak\x2\x2\xF8\xF9\ar\x2\x2\xF9\x42\x3\x2\x2\x2\xFA\xFB\ax\x2\x2\xFB\xFC"+ + "\a\x63\x2\x2\xFC\xFD\at\x2\x2\xFD\x44\x3\x2\x2\x2\xFE\xFF\ak\x2\x2\xFF"+ + "\x100\ap\x2\x2\x100\x46\x3\x2\x2\x2\x101\x102\a?\x2\x2\x102H\x3\x2\x2"+ + "\x2\x103\x104\a\x63\x2\x2\x104\x105\ap\x2\x2\x105\x106\a\x66\x2\x2\x106"+ + "J\x3\x2\x2\x2\x107\x108\aq\x2\x2\x108\x109\at\x2\x2\x109L\x3\x2\x2\x2"+ + "\x10A\x10B\ap\x2\x2\x10B\x10C\aq\x2\x2\x10C\x10D\av\x2\x2\x10DN\x3\x2"+ + "\x2\x2\x10E\x10F\ap\x2\x2\x10F\x110\aw\x2\x2\x110\x111\an\x2\x2\x111\x112"+ + "\an\x2\x2\x112P\x3\x2\x2\x2\x113\x114\at\x2\x2\x114\x115\ag\x2\x2\x115"+ + "\x116\av\x2\x2\x116\x117\aw\x2\x2\x117\x118\at\x2\x2\x118\x119\ap\x2\x2"+ + "\x119R\x3\x2\x2\x2\x11A\x11B\a*\x2\x2\x11BT\x3\x2\x2\x2\x11C\x11D\a+\x2"+ + "\x2\x11DV\x3\x2\x2\x2\x11E\x121\x5\x61\x31\x2\x11F\x121\a\x61\x2\x2\x120"+ + "\x11E\x3\x2\x2\x2\x120\x11F\x3\x2\x2\x2\x121\x126\x3\x2\x2\x2\x122\x125"+ + "\x5\x61\x31\x2\x123\x125\t\x2\x2\x2\x124\x122\x3\x2\x2\x2\x124\x123\x3"+ + "\x2\x2\x2\x125\x128\x3\x2\x2\x2\x126\x124\x3\x2\x2\x2\x126\x127\x3\x2"+ + "\x2\x2\x127X\x3\x2\x2\x2\x128\x126\x3\x2\x2\x2\x129\x12A\a\x31\x2\x2\x12A"+ + "\x12B\a\x31\x2\x2\x12B\x12F\x3\x2\x2\x2\x12C\x12E\v\x2\x2\x2\x12D\x12C"+ + "\x3\x2\x2\x2\x12E\x131\x3\x2\x2\x2\x12F\x130\x3\x2\x2\x2\x12F\x12D\x3"+ + "\x2\x2\x2\x130\x132\x3\x2\x2\x2\x131\x12F\x3\x2\x2\x2\x132\x133\x5o\x38"+ + "\x2\x133\x134\x3\x2\x2\x2\x134\x135\b-\x2\x2\x135Z\x3\x2\x2\x2\x136\x137"+ + "\a\x31\x2\x2\x137\x138\a,\x2\x2\x138\x13C\x3\x2\x2\x2\x139\x13B\v\x2\x2"+ + "\x2\x13A\x139\x3\x2\x2\x2\x13B\x13E\x3\x2\x2\x2\x13C\x13D\x3\x2\x2\x2"+ + "\x13C\x13A\x3\x2\x2\x2\x13D\x13F\x3\x2\x2\x2\x13E\x13C\x3\x2\x2\x2\x13F"+ + "\x140\a,\x2\x2\x140\x141\a\x31\x2\x2\x141\x142\x3\x2\x2\x2\x142\x143\b"+ + ".\x2\x2\x143\\\x3\x2\x2\x2\x144\x146\a}\x2\x2\x145\x147\v\x2\x2\x2\x146"+ + "\x145\x3\x2\x2\x2\x147\x148\x3\x2\x2\x2\x148\x149\x3\x2\x2\x2\x148\x146"+ + "\x3\x2\x2\x2\x149\x14A\x3\x2\x2\x2\x14A\x14B\a\x7F\x2\x2\x14B^\x3\x2\x2"+ + "\x2\x14C\x14F\a\x42\x2\x2\x14D\x150\x5\x61\x31\x2\x14E\x150\a\x61\x2\x2"+ + "\x14F\x14D\x3\x2\x2\x2\x14F\x14E\x3\x2\x2\x2\x150\x155\x3\x2\x2\x2\x151"+ + "\x154\x5\x61\x31\x2\x152\x154\t\x3\x2\x2\x153\x151\x3\x2\x2\x2\x153\x152"+ + "\x3\x2\x2\x2\x154\x157\x3\x2\x2\x2\x155\x153\x3\x2\x2\x2\x155\x156\x3"+ + "\x2\x2\x2\x156`\x3\x2\x2\x2\x157\x155\x3\x2\x2\x2\x158\x159\t\x4\x2\x2"+ + "\x159\x62\x3\x2\x2\x2\x15A\x15E\a$\x2\x2\x15B\x15D\v\x2\x2\x2\x15C\x15B"+ + "\x3\x2\x2\x2\x15D\x160\x3\x2\x2\x2\x15E\x15F\x3\x2\x2\x2\x15E\x15C\x3"+ + "\x2\x2\x2\x15F\x161\x3\x2\x2\x2\x160\x15E\x3\x2\x2\x2\x161\x16B\a$\x2"+ + "\x2\x162\x166\a)\x2\x2\x163\x165\v\x2\x2\x2\x164\x163\x3\x2\x2\x2\x165"+ + "\x168\x3\x2\x2\x2\x166\x167\x3\x2\x2\x2\x166\x164\x3\x2\x2\x2\x167\x169"+ + "\x3\x2\x2\x2\x168\x166\x3\x2\x2\x2\x169\x16B\a)\x2\x2\x16A\x15A\x3\x2"+ + "\x2\x2\x16A\x162\x3\x2\x2\x2\x16B\x64\x3\x2\x2\x2\x16C\x16F\x5g\x34\x2"+ + "\x16D\x16F\x5i\x35\x2\x16E\x16C\x3\x2\x2\x2\x16E\x16D\x3\x2\x2\x2\x16F"+ + "\x66\x3\x2\x2\x2\x170\x172\x5k\x36\x2\x171\x170\x3\x2\x2\x2\x172\x173"+ + "\x3\x2\x2\x2\x173\x171\x3\x2\x2\x2\x173\x174\x3\x2\x2\x2\x174h\x3\x2\x2"+ + "\x2\x175\x177\x5k\x36\x2\x176\x175\x3\x2\x2\x2\x177\x178\x3\x2\x2\x2\x178"+ + "\x176\x3\x2\x2\x2\x178\x179\x3\x2\x2\x2\x179\x17A\x3\x2\x2\x2\x17A\x17E"+ + "\a\x30\x2\x2\x17B\x17D\x5k\x36\x2\x17C\x17B\x3\x2\x2\x2\x17D\x180\x3\x2"+ + "\x2\x2\x17E\x17C\x3\x2\x2\x2\x17E\x17F\x3\x2\x2\x2\x17F\x188\x3\x2\x2"+ + "\x2\x180\x17E\x3\x2\x2\x2\x181\x183\a\x30\x2\x2\x182\x184\x5k\x36\x2\x183"+ + "\x182\x3\x2\x2\x2\x184\x185\x3\x2\x2\x2\x185\x183\x3\x2\x2\x2\x185\x186"+ + "\x3\x2\x2\x2\x186\x188\x3\x2\x2\x2\x187\x176\x3\x2\x2\x2\x187\x181\x3"+ + "\x2\x2\x2\x188j\x3\x2\x2\x2\x189\x18A\t\x5\x2\x2\x18Al\x3\x2\x2\x2\x18B"+ + "\x18D\t\x6\x2\x2\x18C\x18B\x3\x2\x2\x2\x18D\x18E\x3\x2\x2\x2\x18E\x18C"+ + "\x3\x2\x2\x2\x18E\x18F\x3\x2\x2\x2\x18F\x190\x3\x2\x2\x2\x190\x191\b\x37"+ + "\x2\x2\x191n\x3\x2\x2\x2\x192\x194\a\xF\x2\x2\x193\x192\x3\x2\x2\x2\x193"+ + "\x194\x3\x2\x2\x2\x194\x195\x3\x2\x2\x2\x195\x196\a\f\x2\x2\x196\x197"+ + "\x3\x2\x2\x2\x197\x198\b\x38\x2\x2\x198p\x3\x2\x2\x2\x18\x2\xDB\x120\x124"+ + "\x126\x12F\x13C\x148\x14F\x153\x155\x15E\x166\x16A\x16E\x173\x178\x17E"+ + "\x185\x187\x18E\x193\x3\b\x2\x2"; + public static readonly ATN _ATN = + new ATNDeserializer().Deserialize(_serializedATN.ToCharArray()); +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeLexer.tokens b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeLexer.tokens new file mode 100644 index 0000000..bafd1b5 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeLexer.tokens @@ -0,0 +1,92 @@ +FUNCTION=21 +WHILE=23 +DO=26 +NOT=38 +EXPLICIT=30 +AND=36 +ID=43 +T__9=11 +T__8=12 +T__7=13 +T__6=14 +IF=24 +T__5=15 +T__4=16 +T__19=1 +MULTILINE_COMMENT=45 +T__16=4 +BOOLEAN=28 +T__15=5 +IN=34 +T__18=2 +RIGHT_PARENTHESIS=42 +T__17=3 +T__12=8 +T__11=9 +T__14=6 +T__13=7 +LEFT_PARENTHESIS=41 +T__10=10 +RETURN=40 +VAR=33 +COMMENT=44 +IMPLICIT=29 +NULL=39 +ELSE=25 +NUMBER=49 +ATTRIBUTE_ID=47 +WHITESPACE=50 +TREE_SELECTOR=46 +SKIP=32 +NEWLINE=51 +T__1=19 +T__0=20 +T__3=17 +OR=37 +T__2=18 +ASSIGN=35 +FOREACH=22 +END=27 +MACRO=31 +STRING=48 +'foreach'=22 +'end'=27 +'>='=20 +'/'=18 +'=='=19 +'null'=39 +'>'=16 +';'=13 +'return'=40 +'='=35 +'object'=11 +'explicit'=30 +'+'=4 +')'=42 +'.'=2 +'function'=21 +'do'=26 +'skip'=32 +'else'=25 +'and'=36 +'by'=17 +'to'=15 +'var'=33 +'<='=14 +'!='=12 +'<'=10 +'if'=24 +'('=41 +'not'=38 +':'=9 +'or'=37 +'['=8 +'attribute'=7 +'-'=6 +'*'=5 +'while'=23 +','=3 +'in'=34 +'macro'=31 +']'=1 +'implicit'=29 diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeListener.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeListener.cs new file mode 100644 index 0000000..9ac62d2 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeListener.cs @@ -0,0 +1,406 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\MetaCode.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime.Misc; +using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener; +using IToken = Antlr4.Runtime.IToken; + +/// +/// This interface defines a complete listener for a parse tree produced by +/// . +/// +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public interface IMetaCodeListener : IParseTreeListener { + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterExpression([NotNull] MetaCodeParser.ExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitExpression([NotNull] MetaCodeParser.ExpressionContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterFormalParameter([NotNull] MetaCodeParser.FormalParameterContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitFormalParameter([NotNull] MetaCodeParser.FormalParameterContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterReturnStatement([NotNull] MetaCodeParser.ReturnStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitReturnStatement([NotNull] MetaCodeParser.ReturnStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterAttribute([NotNull] MetaCodeParser.AttributeContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitAttribute([NotNull] MetaCodeParser.AttributeContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterBlockStatement([NotNull] MetaCodeParser.BlockStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitBlockStatement([NotNull] MetaCodeParser.BlockStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterIntervalConstant([NotNull] MetaCodeParser.IntervalConstantContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitIntervalConstant([NotNull] MetaCodeParser.IntervalConstantContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterPrimaryExpression([NotNull] MetaCodeParser.PrimaryExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitPrimaryExpression([NotNull] MetaCodeParser.PrimaryExpressionContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterMacroCallExpression([NotNull] MetaCodeParser.MacroCallExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitMacroCallExpression([NotNull] MetaCodeParser.MacroCallExpressionContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterAttributeDeclaration([NotNull] MetaCodeParser.AttributeDeclarationContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitAttributeDeclaration([NotNull] MetaCodeParser.AttributeDeclarationContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterElseIfStatement([NotNull] MetaCodeParser.ElseIfStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitElseIfStatement([NotNull] MetaCodeParser.ElseIfStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterVariableDeclaration([NotNull] MetaCodeParser.VariableDeclarationContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitVariableDeclaration([NotNull] MetaCodeParser.VariableDeclarationContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterFunctionStatement([NotNull] MetaCodeParser.FunctionStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitFunctionStatement([NotNull] MetaCodeParser.FunctionStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterStatements([NotNull] MetaCodeParser.StatementsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitStatements([NotNull] MetaCodeParser.StatementsContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterMacroFormalParameter([NotNull] MetaCodeParser.MacroFormalParameterContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitMacroFormalParameter([NotNull] MetaCodeParser.MacroFormalParameterContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterActualParameterList([NotNull] MetaCodeParser.ActualParameterListContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitActualParameterList([NotNull] MetaCodeParser.ActualParameterListContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterSkipStatement([NotNull] MetaCodeParser.SkipStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitSkipStatement([NotNull] MetaCodeParser.SkipStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterConstant([NotNull] MetaCodeParser.ConstantContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitConstant([NotNull] MetaCodeParser.ConstantContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterBooleanConstant([NotNull] MetaCodeParser.BooleanConstantContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitBooleanConstant([NotNull] MetaCodeParser.BooleanConstantContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterMemberTagExpression([NotNull] MetaCodeParser.MemberTagExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitMemberTagExpression([NotNull] MetaCodeParser.MemberTagExpressionContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterAssignmentExpression([NotNull] MetaCodeParser.AssignmentExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitAssignmentExpression([NotNull] MetaCodeParser.AssignmentExpressionContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInit([NotNull] MetaCodeParser.InitContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInit([NotNull] MetaCodeParser.InitContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterNumberConstant([NotNull] MetaCodeParser.NumberConstantContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitNumberConstant([NotNull] MetaCodeParser.NumberConstantContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterIfStatement([NotNull] MetaCodeParser.IfStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitIfStatement([NotNull] MetaCodeParser.IfStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterTypeName([NotNull] MetaCodeParser.TypeNameContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitTypeName([NotNull] MetaCodeParser.TypeNameContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterMemberExpression([NotNull] MetaCodeParser.MemberExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitMemberExpression([NotNull] MetaCodeParser.MemberExpressionContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterObjectDeclaration([NotNull] MetaCodeParser.ObjectDeclarationContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitObjectDeclaration([NotNull] MetaCodeParser.ObjectDeclarationContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterStatement([NotNull] MetaCodeParser.StatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitStatement([NotNull] MetaCodeParser.StatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterWhileStatement([NotNull] MetaCodeParser.WhileStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitWhileStatement([NotNull] MetaCodeParser.WhileStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterMacroStatement([NotNull] MetaCodeParser.MacroStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitMacroStatement([NotNull] MetaCodeParser.MacroStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterFunctionCallExpression([NotNull] MetaCodeParser.FunctionCallExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitFunctionCallExpression([NotNull] MetaCodeParser.FunctionCallExpressionContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterArrayConstant([NotNull] MetaCodeParser.ArrayConstantContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitArrayConstant([NotNull] MetaCodeParser.ArrayConstantContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterForeachStatement([NotNull] MetaCodeParser.ForeachStatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitForeachStatement([NotNull] MetaCodeParser.ForeachStatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterStringConstant([NotNull] MetaCodeParser.StringConstantContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitStringConstant([NotNull] MetaCodeParser.StringConstantContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterIdentifier([NotNull] MetaCodeParser.IdentifierContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitIdentifier([NotNull] MetaCodeParser.IdentifierContext context); +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeParser.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeParser.cs new file mode 100644 index 0000000..c849b18 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeParser.cs @@ -0,0 +1,3222 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\MetaCode.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime; +using Antlr4.Runtime.Atn; +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using System.Collections.Generic; +using DFA = Antlr4.Runtime.Dfa.DFA; + +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class MetaCodeParser : Parser { + public const int + T__19=1, T__18=2, T__17=3, T__16=4, T__15=5, T__14=6, T__13=7, T__12=8, + T__11=9, T__10=10, T__9=11, T__8=12, T__7=13, T__6=14, T__5=15, T__4=16, + T__3=17, T__2=18, T__1=19, T__0=20, FUNCTION=21, FOREACH=22, WHILE=23, + IF=24, ELSE=25, DO=26, END=27, BOOLEAN=28, IMPLICIT=29, EXPLICIT=30, MACRO=31, + SKIP=32, VAR=33, IN=34, ASSIGN=35, AND=36, OR=37, NOT=38, NULL=39, RETURN=40, + LEFT_PARENTHESIS=41, RIGHT_PARENTHESIS=42, ID=43, COMMENT=44, MULTILINE_COMMENT=45, + TREE_SELECTOR=46, ATTRIBUTE_ID=47, STRING=48, NUMBER=49, WHITESPACE=50, + NEWLINE=51; + public static readonly string[] tokenNames = { + "", "']'", "'.'", "','", "'+'", "'*'", "'-'", "'attribute'", + "'['", "':'", "'<'", "'object'", "'!='", "';'", "'<='", "'to'", "'>'", + "'by'", "'/'", "'=='", "'>='", "'function'", "'foreach'", "'while'", "'if'", + "'else'", "'do'", "'end'", "BOOLEAN", "'implicit'", "'explicit'", "'macro'", + "'skip'", "'var'", "'in'", "'='", "'and'", "'or'", "'not'", "'null'", + "'return'", "'('", "')'", "ID", "COMMENT", "MULTILINE_COMMENT", "TREE_SELECTOR", + "ATTRIBUTE_ID", "STRING", "NUMBER", "WHITESPACE", "NEWLINE" + }; + public const int + RULE_init = 0, RULE_statements = 1, RULE_statement = 2, RULE_variableDeclaration = 3, + RULE_attributeDeclaration = 4, RULE_objectDeclaration = 5, RULE_expression = 6, + RULE_functionCallExpression = 7, RULE_macroCallExpression = 8, RULE_memberExpression = 9, + RULE_memberTagExpression = 10, RULE_primaryExpression = 11, RULE_functionStatement = 12, + RULE_macroStatement = 13, RULE_foreachStatement = 14, RULE_whileStatement = 15, + RULE_blockStatement = 16, RULE_skipStatement = 17, RULE_returnStatement = 18, + RULE_assignmentExpression = 19, RULE_ifStatement = 20, RULE_elseIfStatement = 21, + RULE_formalParameter = 22, RULE_macroFormalParameter = 23, RULE_actualParameterList = 24, + RULE_typeName = 25, RULE_constant = 26, RULE_identifier = 27, RULE_numberConstant = 28, + RULE_stringConstant = 29, RULE_booleanConstant = 30, RULE_arrayConstant = 31, + RULE_intervalConstant = 32, RULE_attribute = 33; + public static readonly string[] ruleNames = { + "init", "statements", "statement", "variableDeclaration", "attributeDeclaration", + "objectDeclaration", "expression", "functionCallExpression", "macroCallExpression", + "memberExpression", "memberTagExpression", "primaryExpression", "functionStatement", + "macroStatement", "foreachStatement", "whileStatement", "blockStatement", + "skipStatement", "returnStatement", "assignmentExpression", "ifStatement", + "elseIfStatement", "formalParameter", "macroFormalParameter", "actualParameterList", + "typeName", "constant", "identifier", "numberConstant", "stringConstant", + "booleanConstant", "arrayConstant", "intervalConstant", "attribute" + }; + + public override string GrammarFileName { get { return "MetaCode.g4"; } } + + public override string[] TokenNames { get { return tokenNames; } } + + public override string[] RuleNames { get { return ruleNames; } } + + public override string SerializedAtn { get { return _serializedATN; } } + + public MetaCodeParser(ITokenStream input) + : base(input) + { + _interp = new ParserATNSimulator(this,_ATN); + } + public partial class InitContext : ParserRuleContext { + public StatementsContext statements() { + return GetRuleContext(0); + } + public InitContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_init; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterInit(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitInit(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitInit(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InitContext init() { + InitContext _localctx = new InitContext(_ctx, State); + EnterRule(_localctx, 0, RULE_init); + try { + EnterOuterAlt(_localctx, 1); + { + State = 68; statements(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class StatementsContext : ParserRuleContext { + public IReadOnlyList statement() { + return GetRuleContexts(); + } + public StatementContext statement(int i) { + return GetRuleContext(i); + } + public StatementsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_statements; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterStatements(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitStatements(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitStatements(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public StatementsContext statements() { + StatementsContext _localctx = new StatementsContext(_ctx, State); + EnterRule(_localctx, 2, RULE_statements); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 73; + _errHandler.Sync(this); + _la = _input.La(1); + do { + { + { + State = 70; statement(); + State = 71; Match(13); + } + } + State = 75; + _errHandler.Sync(this); + _la = _input.La(1); + } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 7) | (1L << 8) | (1L << 11) | (1L << FUNCTION) | (1L << FOREACH) | (1L << WHILE) | (1L << IF) | (1L << DO) | (1L << BOOLEAN) | (1L << MACRO) | (1L << SKIP) | (1L << VAR) | (1L << NOT) | (1L << NULL) | (1L << RETURN) | (1L << LEFT_PARENTHESIS) | (1L << ID) | (1L << TREE_SELECTOR) | (1L << ATTRIBUTE_ID) | (1L << STRING) | (1L << NUMBER))) != 0) ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class StatementContext : ParserRuleContext { + public ExpressionContext Expression; + public ReturnStatementContext Return; + public FunctionStatementContext FunctionDeclaration; + public MacroStatementContext MacroDeclaration; + public VariableDeclarationContext VariableDeclaration; + public ObjectDeclarationContext ObjectDeclaration; + public AttributeDeclarationContext AttributeDeclaration; + public IfStatementContext If; + public BlockStatementContext Block; + public ForeachStatementContext Foreach; + public WhileStatementContext While; + public SkipStatementContext Skip; + public BlockStatementContext blockStatement() { + return GetRuleContext(0); + } + public IfStatementContext ifStatement() { + return GetRuleContext(0); + } + public MacroStatementContext macroStatement() { + return GetRuleContext(0); + } + public AttributeDeclarationContext attributeDeclaration() { + return GetRuleContext(0); + } + public SkipStatementContext skipStatement() { + return GetRuleContext(0); + } + public ReturnStatementContext returnStatement() { + return GetRuleContext(0); + } + public WhileStatementContext whileStatement() { + return GetRuleContext(0); + } + public ForeachStatementContext foreachStatement() { + return GetRuleContext(0); + } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public FunctionStatementContext functionStatement() { + return GetRuleContext(0); + } + public ObjectDeclarationContext objectDeclaration() { + return GetRuleContext(0); + } + public VariableDeclarationContext variableDeclaration() { + return GetRuleContext(0); + } + public StatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_statement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public StatementContext statement() { + StatementContext _localctx = new StatementContext(_ctx, State); + EnterRule(_localctx, 4, RULE_statement); + try { + State = 89; + switch ( Interpreter.AdaptivePredict(_input,1,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 77; _localctx.Expression = expression(0); + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 78; _localctx.Return = returnStatement(); + } + break; + + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 79; _localctx.FunctionDeclaration = functionStatement(); + } + break; + + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 80; _localctx.MacroDeclaration = macroStatement(); + } + break; + + case 5: + EnterOuterAlt(_localctx, 5); + { + State = 81; _localctx.VariableDeclaration = variableDeclaration(); + } + break; + + case 6: + EnterOuterAlt(_localctx, 6); + { + State = 82; _localctx.ObjectDeclaration = objectDeclaration(); + } + break; + + case 7: + EnterOuterAlt(_localctx, 7); + { + State = 83; _localctx.AttributeDeclaration = attributeDeclaration(); + } + break; + + case 8: + EnterOuterAlt(_localctx, 8); + { + State = 84; _localctx.If = ifStatement(); + } + break; + + case 9: + EnterOuterAlt(_localctx, 9); + { + State = 85; _localctx.Block = blockStatement(); + } + break; + + case 10: + EnterOuterAlt(_localctx, 10); + { + State = 86; _localctx.Foreach = foreachStatement(); + } + break; + + case 11: + EnterOuterAlt(_localctx, 11); + { + State = 87; _localctx.While = whileStatement(); + } + break; + + case 12: + EnterOuterAlt(_localctx, 12); + { + State = 88; _localctx.Skip = skipStatement(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class VariableDeclarationContext : ParserRuleContext { + public IToken VariableName; + public TypeNameContext VariableType; + public ExpressionContext VariableDefaultValue; + public TypeNameContext typeName() { + return GetRuleContext(0); + } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode ASSIGN() { return GetToken(MetaCodeParser.ASSIGN, 0); } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public ITerminalNode VAR() { return GetToken(MetaCodeParser.VAR, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public VariableDeclarationContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_variableDeclaration; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterVariableDeclaration(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitVariableDeclaration(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitVariableDeclaration(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public VariableDeclarationContext variableDeclaration() { + VariableDeclarationContext _localctx = new VariableDeclarationContext(_ctx, State); + EnterRule(_localctx, 6, RULE_variableDeclaration); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 94; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 91; attribute(); + } + } + State = 96; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 97; Match(VAR); + State = 98; _localctx.VariableName = Match(ID); + State = 101; + _la = _input.La(1); + if (_la==9) { + { + State = 99; Match(9); + State = 100; _localctx.VariableType = typeName(); + } + } + + State = 105; + _la = _input.La(1); + if (_la==ASSIGN) { + { + State = 103; Match(ASSIGN); + State = 104; _localctx.VariableDefaultValue = expression(0); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class AttributeDeclarationContext : ParserRuleContext { + public IToken AttributeName; + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public IReadOnlyList formalParameter() { + return GetRuleContexts(); + } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ITerminalNode ATTRIBUTE_ID() { return GetToken(MetaCodeParser.ATTRIBUTE_ID, 0); } + public FormalParameterContext formalParameter(int i) { + return GetRuleContext(i); + } + public AttributeDeclarationContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_attributeDeclaration; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterAttributeDeclaration(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitAttributeDeclaration(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitAttributeDeclaration(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public AttributeDeclarationContext attributeDeclaration() { + AttributeDeclarationContext _localctx = new AttributeDeclarationContext(_ctx, State); + EnterRule(_localctx, 8, RULE_attributeDeclaration); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 110; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 107; attribute(); + } + } + State = 112; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 113; Match(7); + State = 114; _localctx.AttributeName = Match(ATTRIBUTE_ID); + State = 126; + _la = _input.La(1); + if (_la==LEFT_PARENTHESIS) { + { + State = 115; Match(LEFT_PARENTHESIS); + State = 116; formalParameter(); + State = 121; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 117; Match(3); + State = 118; formalParameter(); + } + } + State = 123; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 124; Match(RIGHT_PARENTHESIS); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ObjectDeclarationContext : ParserRuleContext { + public IToken ObjectName; + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public IReadOnlyList formalParameter() { + return GetRuleContexts(); + } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public FormalParameterContext formalParameter(int i) { + return GetRuleContext(i); + } + public ITerminalNode END() { return GetToken(MetaCodeParser.END, 0); } + public ObjectDeclarationContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_objectDeclaration; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterObjectDeclaration(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitObjectDeclaration(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitObjectDeclaration(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ObjectDeclarationContext objectDeclaration() { + ObjectDeclarationContext _localctx = new ObjectDeclarationContext(_ctx, State); + EnterRule(_localctx, 10, RULE_objectDeclaration); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 131; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 128; attribute(); + } + } + State = 133; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 134; Match(11); + State = 135; _localctx.ObjectName = Match(ID); + State = 139; + _errHandler.Sync(this); + _la = _input.La(1); + do { + { + { + State = 136; formalParameter(); + State = 137; Match(13); + } + } + State = 141; + _errHandler.Sync(this); + _la = _input.La(1); + } while ( _la==ID || _la==ATTRIBUTE_ID ); + State = 143; Match(END); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ExpressionContext : ParserRuleContext { + public ExpressionContext Left; + public IToken Operator; + public ExpressionContext Expression; + public PrimaryExpressionContext PrimaryExpression; + public FunctionCallExpressionContext FunctionCallExpression; + public MacroCallExpressionContext MacroCallExpression; + public MemberExpressionContext MemberExpression; + public ExpressionContext Right; + public MacroCallExpressionContext macroCallExpression() { + return GetRuleContext(0); + } + public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + public FunctionCallExpressionContext functionCallExpression() { + return GetRuleContext(0); + } + public ITerminalNode AND() { return GetToken(MetaCodeParser.AND, 0); } + public ITerminalNode OR() { return GetToken(MetaCodeParser.OR, 0); } + public MemberExpressionContext memberExpression() { + return GetRuleContext(0); + } + public ITerminalNode NOT() { return GetToken(MetaCodeParser.NOT, 0); } + public IReadOnlyList expression() { + return GetRuleContexts(); + } + public PrimaryExpressionContext primaryExpression() { + return GetRuleContext(0); + } + public ExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_expression; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterExpression(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitExpression(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ExpressionContext expression() { + return expression(0); + } + + private ExpressionContext expression(int _p) { + ParserRuleContext _parentctx = _ctx; + int _parentState = State; + ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); + ExpressionContext _prevctx = _localctx; + int _startState = 12; + EnterRecursionRule(_localctx, 12, RULE_expression, _p); + try { + int _alt; + EnterOuterAlt(_localctx, 1); + { + State = 152; + switch ( Interpreter.AdaptivePredict(_input,10,_ctx) ) { + case 1: + { + State = 146; _localctx.Operator = Match(NOT); + State = 147; _localctx.Expression = expression(13); + } + break; + + case 2: + { + State = 148; _localctx.PrimaryExpression = primaryExpression(); + } + break; + + case 3: + { + State = 149; _localctx.FunctionCallExpression = functionCallExpression(); + } + break; + + case 4: + { + State = 150; _localctx.MacroCallExpression = macroCallExpression(); + } + break; + + case 5: + { + State = 151; _localctx.MemberExpression = memberExpression(); + } + break; + } + _ctx.stop = _input.Lt(-1); + State = 192; + _errHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(_input,12,_ctx); + while ( _alt!=2 && _alt!=-1 ) { + if ( _alt==1 ) { + if ( _parseListeners!=null ) TriggerExitRuleEvent(); + _prevctx = _localctx; + { + State = 190; + switch ( Interpreter.AdaptivePredict(_input,11,_ctx) ) { + case 1: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 154; + if (!(Precpred(_ctx, 12))) throw new FailedPredicateException(this, "Precpred(_ctx, 12)"); + State = 155; _localctx.Operator = Match(4); + State = 156; _localctx.Right = expression(13); + } + break; + + case 2: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 157; + if (!(Precpred(_ctx, 11))) throw new FailedPredicateException(this, "Precpred(_ctx, 11)"); + State = 158; _localctx.Operator = Match(6); + State = 159; _localctx.Right = expression(12); + } + break; + + case 3: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 160; + if (!(Precpred(_ctx, 10))) throw new FailedPredicateException(this, "Precpred(_ctx, 10)"); + State = 161; _localctx.Operator = Match(5); + State = 162; _localctx.Right = expression(11); + } + break; + + case 4: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 163; + if (!(Precpred(_ctx, 9))) throw new FailedPredicateException(this, "Precpred(_ctx, 9)"); + State = 164; _localctx.Operator = Match(18); + State = 165; _localctx.Right = expression(10); + } + break; + + case 5: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 166; + if (!(Precpred(_ctx, 8))) throw new FailedPredicateException(this, "Precpred(_ctx, 8)"); + State = 167; _localctx.Operator = Match(10); + State = 168; _localctx.Right = expression(9); + } + break; + + case 6: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 169; + if (!(Precpred(_ctx, 7))) throw new FailedPredicateException(this, "Precpred(_ctx, 7)"); + State = 170; _localctx.Operator = Match(16); + State = 171; _localctx.Right = expression(8); + } + break; + + case 7: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 172; + if (!(Precpred(_ctx, 6))) throw new FailedPredicateException(this, "Precpred(_ctx, 6)"); + State = 173; _localctx.Operator = Match(14); + State = 174; _localctx.Right = expression(7); + } + break; + + case 8: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 175; + if (!(Precpred(_ctx, 5))) throw new FailedPredicateException(this, "Precpred(_ctx, 5)"); + State = 176; _localctx.Operator = Match(20); + State = 177; _localctx.Right = expression(6); + } + break; + + case 9: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 178; + if (!(Precpred(_ctx, 4))) throw new FailedPredicateException(this, "Precpred(_ctx, 4)"); + State = 179; _localctx.Operator = Match(19); + State = 180; _localctx.Right = expression(5); + } + break; + + case 10: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 181; + if (!(Precpred(_ctx, 3))) throw new FailedPredicateException(this, "Precpred(_ctx, 3)"); + State = 182; _localctx.Operator = Match(12); + State = 183; _localctx.Right = expression(4); + } + break; + + case 11: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 184; + if (!(Precpred(_ctx, 2))) throw new FailedPredicateException(this, "Precpred(_ctx, 2)"); + State = 185; _localctx.Operator = Match(AND); + State = 186; _localctx.Right = expression(3); + } + break; + + case 12: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + _localctx.Left = _prevctx; + PushNewRecursionContext(_localctx, _startState, RULE_expression); + State = 187; + if (!(Precpred(_ctx, 1))) throw new FailedPredicateException(this, "Precpred(_ctx, 1)"); + State = 188; _localctx.Operator = Match(OR); + State = 189; _localctx.Right = expression(2); + } + break; + } + } + } + State = 194; + _errHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(_input,12,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + UnrollRecursionContexts(_parentctx); + } + return _localctx; + } + + public partial class FunctionCallExpressionContext : ParserRuleContext { + public IToken functionName; + public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public IReadOnlyList expression() { + return GetRuleContexts(); + } + public FunctionCallExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_functionCallExpression; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterFunctionCallExpression(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitFunctionCallExpression(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitFunctionCallExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public FunctionCallExpressionContext functionCallExpression() { + FunctionCallExpressionContext _localctx = new FunctionCallExpressionContext(_ctx, State); + EnterRule(_localctx, 14, RULE_functionCallExpression); + int _la; + try { + State = 210; + switch ( Interpreter.AdaptivePredict(_input,14,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 195; _localctx.functionName = Match(ID); + State = 196; Match(LEFT_PARENTHESIS); + State = 197; expression(0); + State = 202; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 198; Match(3); + State = 199; expression(0); + } + } + State = 204; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 205; Match(RIGHT_PARENTHESIS); + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 207; _localctx.functionName = Match(ID); + State = 208; Match(LEFT_PARENTHESIS); + State = 209; Match(RIGHT_PARENTHESIS); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class MacroCallExpressionContext : ParserRuleContext { + public IToken macroName; + public IReadOnlyList statement() { + return GetRuleContexts(); + } + public ITerminalNode MACRO() { return GetToken(MetaCodeParser.MACRO, 0); } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public StatementContext statement(int i) { + return GetRuleContext(i); + } + public MacroCallExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_macroCallExpression; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterMacroCallExpression(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitMacroCallExpression(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitMacroCallExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MacroCallExpressionContext macroCallExpression() { + MacroCallExpressionContext _localctx = new MacroCallExpressionContext(_ctx, State); + EnterRule(_localctx, 16, RULE_macroCallExpression); + int _la; + try { + State = 229; + switch ( Interpreter.AdaptivePredict(_input,16,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 212; Match(MACRO); + State = 213; _localctx.macroName = Match(ID); + State = 214; Match(LEFT_PARENTHESIS); + State = 215; statement(); + State = 220; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 216; Match(3); + State = 217; statement(); + } + } + State = 222; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 223; Match(RIGHT_PARENTHESIS); + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 225; Match(MACRO); + State = 226; _localctx.macroName = Match(ID); + State = 227; Match(LEFT_PARENTHESIS); + State = 228; Match(RIGHT_PARENTHESIS); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class MemberExpressionContext : ParserRuleContext { + public IReadOnlyList ID() { return GetTokens(MetaCodeParser.ID); } + public ITerminalNode ID(int i) { + return GetToken(MetaCodeParser.ID, i); + } + public MemberExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_memberExpression; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterMemberExpression(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitMemberExpression(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitMemberExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MemberExpressionContext memberExpression() { + MemberExpressionContext _localctx = new MemberExpressionContext(_ctx, State); + EnterRule(_localctx, 18, RULE_memberExpression); + try { + int _alt; + EnterOuterAlt(_localctx, 1); + { + State = 231; Match(ID); + State = 234; + _errHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(_input,17,_ctx); + do { + switch (_alt) { + case 1: + { + { + State = 232; Match(2); + State = 233; Match(ID); + } + } + break; + default: + throw new NoViableAltException(this); + } + State = 236; + _errHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(_input,17,_ctx); + } while ( _alt!=2 && _alt!=-1 ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class MemberTagExpressionContext : ParserRuleContext { + public FunctionCallExpressionContext functionCallExpression() { + return GetRuleContext(0); + } + public IdentifierContext identifier() { + return GetRuleContext(0); + } + public MemberTagExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_memberTagExpression; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterMemberTagExpression(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitMemberTagExpression(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitMemberTagExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MemberTagExpressionContext memberTagExpression() { + MemberTagExpressionContext _localctx = new MemberTagExpressionContext(_ctx, State); + EnterRule(_localctx, 20, RULE_memberTagExpression); + try { + State = 240; + switch ( Interpreter.AdaptivePredict(_input,18,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 238; identifier(); + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 239; functionCallExpression(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class PrimaryExpressionContext : ParserRuleContext { + public AttributeContext Attributes; + public ConstantContext Constant; + public IToken Id; + public AssignmentExpressionContext Assignment; + public ExpressionContext InnerExpression; + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public AssignmentExpressionContext assignmentExpression() { + return GetRuleContext(0); + } + public ConstantContext constant() { + return GetRuleContext(0); + } + public PrimaryExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_primaryExpression; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterPrimaryExpression(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitPrimaryExpression(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitPrimaryExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public PrimaryExpressionContext primaryExpression() { + PrimaryExpressionContext _localctx = new PrimaryExpressionContext(_ctx, State); + EnterRule(_localctx, 22, RULE_primaryExpression); + int _la; + try { + State = 273; + switch ( Interpreter.AdaptivePredict(_input,23,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 245; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 242; _localctx.Attributes = attribute(); + } + } + State = 247; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 248; _localctx.Constant = constant(); + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 252; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 249; _localctx.Attributes = attribute(); + } + } + State = 254; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 255; _localctx.Id = Match(ID); + } + break; + + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 259; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 256; _localctx.Attributes = attribute(); + } + } + State = 261; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 262; _localctx.Assignment = assignmentExpression(); + } + break; + + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 266; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 263; _localctx.Attributes = attribute(); + } + } + State = 268; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 269; Match(LEFT_PARENTHESIS); + State = 270; _localctx.InnerExpression = expression(0); + State = 271; Match(RIGHT_PARENTHESIS); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class FunctionStatementContext : ParserRuleContext { + public IToken FunctionName; + public FormalParameterContext Parameter; + public TypeNameContext ReturnType; + public StatementsContext BodyStatements; + public TypeNameContext typeName() { + return GetRuleContext(0); + } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public StatementsContext statements() { + return GetRuleContext(0); + } + public ITerminalNode DO() { return GetToken(MetaCodeParser.DO, 0); } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public ITerminalNode FUNCTION() { return GetToken(MetaCodeParser.FUNCTION, 0); } + public IReadOnlyList formalParameter() { + return GetRuleContexts(); + } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public FormalParameterContext formalParameter(int i) { + return GetRuleContext(i); + } + public ITerminalNode END() { return GetToken(MetaCodeParser.END, 0); } + public FunctionStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_functionStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterFunctionStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitFunctionStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitFunctionStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public FunctionStatementContext functionStatement() { + FunctionStatementContext _localctx = new FunctionStatementContext(_ctx, State); + EnterRule(_localctx, 24, RULE_functionStatement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 278; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 275; attribute(); + } + } + State = 280; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 281; Match(FUNCTION); + State = 282; _localctx.FunctionName = Match(ID); + State = 294; + _la = _input.La(1); + if (_la==LEFT_PARENTHESIS) { + { + State = 283; Match(LEFT_PARENTHESIS); + State = 284; _localctx.Parameter = formalParameter(); + State = 289; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 285; Match(3); + State = 286; _localctx.Parameter = formalParameter(); + } + } + State = 291; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 292; Match(RIGHT_PARENTHESIS); + } + } + + { + State = 296; Match(9); + State = 297; _localctx.ReturnType = typeName(); + } + State = 299; Match(DO); + State = 300; _localctx.BodyStatements = statements(); + State = 301; Match(END); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class MacroStatementContext : ParserRuleContext { + public IToken MacroName; + public StatementsContext BodyStatements; + public ITerminalNode MACRO() { return GetToken(MetaCodeParser.MACRO, 0); } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public StatementsContext statements() { + return GetRuleContext(0); + } + public ITerminalNode DO() { return GetToken(MetaCodeParser.DO, 0); } + public IReadOnlyList macroFormalParameter() { + return GetRuleContexts(); + } + public MacroFormalParameterContext macroFormalParameter(int i) { + return GetRuleContext(i); + } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ITerminalNode END() { return GetToken(MetaCodeParser.END, 0); } + public MacroStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_macroStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterMacroStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitMacroStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitMacroStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MacroStatementContext macroStatement() { + MacroStatementContext _localctx = new MacroStatementContext(_ctx, State); + EnterRule(_localctx, 26, RULE_macroStatement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 306; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 303; attribute(); + } + } + State = 308; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 309; Match(MACRO); + State = 310; _localctx.MacroName = Match(ID); + State = 311; Match(LEFT_PARENTHESIS); + State = 312; macroFormalParameter(); + State = 317; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 313; Match(3); + State = 314; macroFormalParameter(); + } + } + State = 319; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 320; Match(RIGHT_PARENTHESIS); + State = 321; Match(DO); + State = 322; _localctx.BodyStatements = statements(); + State = 323; Match(END); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ForeachStatementContext : ParserRuleContext { + public IToken Var; + public IToken Id; + public TypeNameContext VariableType; + public ExpressionContext ArrayExpression; + public StatementContext Body; + public StatementContext statement() { + return GetRuleContext(0); + } + public ITerminalNode IN() { return GetToken(MetaCodeParser.IN, 0); } + public TypeNameContext typeName() { + return GetRuleContext(0); + } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public ITerminalNode VAR() { return GetToken(MetaCodeParser.VAR, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public ITerminalNode FOREACH() { return GetToken(MetaCodeParser.FOREACH, 0); } + public ForeachStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_foreachStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterForeachStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitForeachStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitForeachStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ForeachStatementContext foreachStatement() { + ForeachStatementContext _localctx = new ForeachStatementContext(_ctx, State); + EnterRule(_localctx, 28, RULE_foreachStatement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 328; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 325; attribute(); + } + } + State = 330; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 331; Match(FOREACH); + State = 332; Match(LEFT_PARENTHESIS); + State = 333; _localctx.Var = Match(VAR); + State = 334; _localctx.Id = Match(ID); + { + State = 335; Match(9); + State = 336; _localctx.VariableType = typeName(); + } + State = 338; Match(IN); + State = 339; _localctx.ArrayExpression = expression(0); + State = 340; Match(RIGHT_PARENTHESIS); + State = 341; _localctx.Body = statement(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class WhileStatementContext : ParserRuleContext { + public ExpressionContext ConditionExpression; + public StatementContext Body; + public StatementContext statement() { + return GetRuleContext(0); + } + public ITerminalNode WHILE() { return GetToken(MetaCodeParser.WHILE, 0); } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public WhileStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_whileStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterWhileStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitWhileStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitWhileStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public WhileStatementContext whileStatement() { + WhileStatementContext _localctx = new WhileStatementContext(_ctx, State); + EnterRule(_localctx, 30, RULE_whileStatement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 346; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 343; attribute(); + } + } + State = 348; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 349; Match(WHILE); + State = 350; Match(LEFT_PARENTHESIS); + State = 351; _localctx.ConditionExpression = expression(0); + State = 352; Match(RIGHT_PARENTHESIS); + State = 353; _localctx.Body = statement(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class BlockStatementContext : ParserRuleContext { + public IReadOnlyList statement() { + return GetRuleContexts(); + } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode DO() { return GetToken(MetaCodeParser.DO, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public StatementContext statement(int i) { + return GetRuleContext(i); + } + public ITerminalNode END() { return GetToken(MetaCodeParser.END, 0); } + public BlockStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_blockStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterBlockStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitBlockStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitBlockStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public BlockStatementContext blockStatement() { + BlockStatementContext _localctx = new BlockStatementContext(_ctx, State); + EnterRule(_localctx, 32, RULE_blockStatement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 358; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 355; attribute(); + } + } + State = 360; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 361; Match(DO); + State = 367; + _errHandler.Sync(this); + _la = _input.La(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 7) | (1L << 8) | (1L << 11) | (1L << FUNCTION) | (1L << FOREACH) | (1L << WHILE) | (1L << IF) | (1L << DO) | (1L << BOOLEAN) | (1L << MACRO) | (1L << SKIP) | (1L << VAR) | (1L << NOT) | (1L << NULL) | (1L << RETURN) | (1L << LEFT_PARENTHESIS) | (1L << ID) | (1L << TREE_SELECTOR) | (1L << ATTRIBUTE_ID) | (1L << STRING) | (1L << NUMBER))) != 0)) { + { + { + State = 362; statement(); + State = 363; Match(13); + } + } + State = 369; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 370; Match(END); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class SkipStatementContext : ParserRuleContext { + public ITerminalNode SKIP() { return GetToken(MetaCodeParser.SKIP, 0); } + public SkipStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_skipStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterSkipStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitSkipStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitSkipStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public SkipStatementContext skipStatement() { + SkipStatementContext _localctx = new SkipStatementContext(_ctx, State); + EnterRule(_localctx, 34, RULE_skipStatement); + try { + EnterOuterAlt(_localctx, 1); + { + State = 372; Match(SKIP); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ReturnStatementContext : ParserRuleContext { + public ExpressionContext ReturnExpression; + public ITerminalNode RETURN() { return GetToken(MetaCodeParser.RETURN, 0); } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public ReturnStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_returnStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterReturnStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitReturnStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitReturnStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ReturnStatementContext returnStatement() { + ReturnStatementContext _localctx = new ReturnStatementContext(_ctx, State); + EnterRule(_localctx, 36, RULE_returnStatement); + try { + EnterOuterAlt(_localctx, 1); + { + State = 374; Match(RETURN); + State = 375; _localctx.ReturnExpression = expression(0); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class AssignmentExpressionContext : ParserRuleContext { + public MemberExpressionContext LeftValue; + public ExpressionContext RightValue; + public AttributeContext ConditionalAttributes; + public ExpressionContext ConditionalExpression; + public IToken VariableName; + public ITerminalNode IF() { return GetToken(MetaCodeParser.IF, 0); } + public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode ASSIGN() { return GetToken(MetaCodeParser.ASSIGN, 0); } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public MemberExpressionContext memberExpression() { + return GetRuleContext(0); + } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public IReadOnlyList expression() { + return GetRuleContexts(); + } + public AssignmentExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_assignmentExpression; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterAssignmentExpression(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitAssignmentExpression(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitAssignmentExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public AssignmentExpressionContext assignmentExpression() { + AssignmentExpressionContext _localctx = new AssignmentExpressionContext(_ctx, State); + EnterRule(_localctx, 38, RULE_assignmentExpression); + int _la; + try { + State = 409; + switch ( Interpreter.AdaptivePredict(_input,37,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 377; _localctx.LeftValue = memberExpression(); + State = 378; Match(ASSIGN); + State = 379; _localctx.RightValue = expression(0); + State = 391; + switch ( Interpreter.AdaptivePredict(_input,34,_ctx) ) { + case 1: + { + State = 383; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 380; _localctx.ConditionalAttributes = attribute(); + } + } + State = 385; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 386; Match(IF); + State = 387; Match(LEFT_PARENTHESIS); + State = 388; _localctx.ConditionalExpression = expression(0); + State = 389; Match(RIGHT_PARENTHESIS); + } + break; + } + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 393; _localctx.VariableName = Match(ID); + State = 394; Match(ASSIGN); + State = 395; _localctx.RightValue = expression(0); + State = 407; + switch ( Interpreter.AdaptivePredict(_input,36,_ctx) ) { + case 1: + { + State = 399; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 396; _localctx.ConditionalAttributes = attribute(); + } + } + State = 401; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 402; Match(IF); + State = 403; Match(LEFT_PARENTHESIS); + State = 404; _localctx.ConditionalExpression = expression(0); + State = 405; Match(RIGHT_PARENTHESIS); + } + break; + } + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class IfStatementContext : ParserRuleContext { + public ExpressionContext Condition; + public StatementsContext Statements; + public ElseIfStatementContext ElseIfStatements; + public StatementsContext ElseStatements; + public ITerminalNode IF() { return GetToken(MetaCodeParser.IF, 0); } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public IReadOnlyList statements() { + return GetRuleContexts(); + } + public ElseIfStatementContext elseIfStatement(int i) { + return GetRuleContext(i); + } + public ITerminalNode ELSE() { return GetToken(MetaCodeParser.ELSE, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public StatementsContext statements(int i) { + return GetRuleContext(i); + } + public IReadOnlyList elseIfStatement() { + return GetRuleContexts(); + } + public ITerminalNode END() { return GetToken(MetaCodeParser.END, 0); } + public IfStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_ifStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterIfStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitIfStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitIfStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public IfStatementContext ifStatement() { + IfStatementContext _localctx = new IfStatementContext(_ctx, State); + EnterRule(_localctx, 40, RULE_ifStatement); + int _la; + try { + int _alt; + EnterOuterAlt(_localctx, 1); + { + State = 414; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 411; attribute(); + } + } + State = 416; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 417; Match(IF); + State = 418; Match(LEFT_PARENTHESIS); + State = 419; _localctx.Condition = expression(0); + State = 420; Match(RIGHT_PARENTHESIS); + State = 421; _localctx.Statements = statements(); + State = 425; + _errHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(_input,39,_ctx); + while ( _alt!=2 && _alt!=-1 ) { + if ( _alt==1 ) { + { + { + State = 422; _localctx.ElseIfStatements = elseIfStatement(); + } + } + } + State = 427; + _errHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(_input,39,_ctx); + } + State = 430; + _la = _input.La(1); + if (_la==ELSE) { + { + State = 428; Match(ELSE); + State = 429; _localctx.ElseStatements = statements(); + } + } + + State = 432; Match(END); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ElseIfStatementContext : ParserRuleContext { + public ExpressionContext Condition; + public StatementsContext Statements; + public ITerminalNode IF() { return GetToken(MetaCodeParser.IF, 0); } + public StatementsContext statements() { + return GetRuleContext(0); + } + public ITerminalNode ELSE() { return GetToken(MetaCodeParser.ELSE, 0); } + public ExpressionContext expression() { + return GetRuleContext(0); + } + public ElseIfStatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_elseIfStatement; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterElseIfStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitElseIfStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitElseIfStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ElseIfStatementContext elseIfStatement() { + ElseIfStatementContext _localctx = new ElseIfStatementContext(_ctx, State); + EnterRule(_localctx, 42, RULE_elseIfStatement); + try { + EnterOuterAlt(_localctx, 1); + { + State = 434; Match(ELSE); + State = 435; Match(IF); + State = 436; Match(LEFT_PARENTHESIS); + State = 437; _localctx.Condition = expression(0); + State = 438; Match(RIGHT_PARENTHESIS); + State = 439; _localctx.Statements = statements(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class FormalParameterContext : ParserRuleContext { + public AttributeContext Attributes; + public IToken Name; + public TypeNameContext Type; + public TypeNameContext typeName() { + return GetRuleContext(0); + } + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public FormalParameterContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_formalParameter; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterFormalParameter(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitFormalParameter(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitFormalParameter(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public FormalParameterContext formalParameter() { + FormalParameterContext _localctx = new FormalParameterContext(_ctx, State); + EnterRule(_localctx, 44, RULE_formalParameter); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 444; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 441; _localctx.Attributes = attribute(); + } + } + State = 446; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 447; _localctx.Name = Match(ID); + State = 448; Match(9); + State = 449; _localctx.Type = typeName(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class MacroFormalParameterContext : ParserRuleContext { + public IToken Name; + public IToken Selector; + public ITerminalNode TREE_SELECTOR() { return GetToken(MetaCodeParser.TREE_SELECTOR, 0); } + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public MacroFormalParameterContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_macroFormalParameter; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterMacroFormalParameter(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitMacroFormalParameter(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitMacroFormalParameter(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MacroFormalParameterContext macroFormalParameter() { + MacroFormalParameterContext _localctx = new MacroFormalParameterContext(_ctx, State); + EnterRule(_localctx, 46, RULE_macroFormalParameter); + try { + EnterOuterAlt(_localctx, 1); + { + State = 451; _localctx.Name = Match(ID); + State = 452; Match(9); + State = 453; _localctx.Selector = Match(TREE_SELECTOR); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ActualParameterListContext : ParserRuleContext { + public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + public IReadOnlyList expression() { + return GetRuleContexts(); + } + public ActualParameterListContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_actualParameterList; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterActualParameterList(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitActualParameterList(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitActualParameterList(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ActualParameterListContext actualParameterList() { + ActualParameterListContext _localctx = new ActualParameterListContext(_ctx, State); + EnterRule(_localctx, 48, RULE_actualParameterList); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 455; expression(0); + State = 460; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 456; Match(3); + State = 457; expression(0); + } + } + State = 462; + _errHandler.Sync(this); + _la = _input.La(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class TypeNameContext : ParserRuleContext { + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public IReadOnlyList ID() { return GetTokens(MetaCodeParser.ID); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public ITerminalNode ID(int i) { + return GetToken(MetaCodeParser.ID, i); + } + public TypeNameContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_typeName; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterTypeName(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitTypeName(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitTypeName(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public TypeNameContext typeName() { + TypeNameContext _localctx = new TypeNameContext(_ctx, State); + EnterRule(_localctx, 50, RULE_typeName); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 466; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==ATTRIBUTE_ID) { + { + { + State = 463; attribute(); + } + } + State = 468; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 469; Match(ID); + State = 474; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==2) { + { + { + State = 470; Match(2); + State = 471; Match(ID); + } + } + State = 476; + _errHandler.Sync(this); + _la = _input.La(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ConstantContext : ParserRuleContext { + public NumberConstantContext Number; + public StringConstantContext String; + public BooleanConstantContext Boolean; + public ArrayConstantContext Array; + public IntervalConstantContext Interval; + public IToken Null; + public IToken TreeSelector; + public NumberConstantContext numberConstant() { + return GetRuleContext(0); + } + public ITerminalNode TREE_SELECTOR() { return GetToken(MetaCodeParser.TREE_SELECTOR, 0); } + public ArrayConstantContext arrayConstant() { + return GetRuleContext(0); + } + public BooleanConstantContext booleanConstant() { + return GetRuleContext(0); + } + public IntervalConstantContext intervalConstant() { + return GetRuleContext(0); + } + public StringConstantContext stringConstant() { + return GetRuleContext(0); + } + public ITerminalNode NULL() { return GetToken(MetaCodeParser.NULL, 0); } + public ConstantContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_constant; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterConstant(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitConstant(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitConstant(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ConstantContext constant() { + ConstantContext _localctx = new ConstantContext(_ctx, State); + EnterRule(_localctx, 52, RULE_constant); + try { + State = 484; + switch ( Interpreter.AdaptivePredict(_input,45,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 477; _localctx.Number = numberConstant(); + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 478; _localctx.String = stringConstant(); + } + break; + + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 479; _localctx.Boolean = booleanConstant(); + } + break; + + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 480; _localctx.Array = arrayConstant(); + } + break; + + case 5: + EnterOuterAlt(_localctx, 5); + { + State = 481; _localctx.Interval = intervalConstant(); + } + break; + + case 6: + EnterOuterAlt(_localctx, 6); + { + State = 482; _localctx.Null = Match(NULL); + } + break; + + case 7: + EnterOuterAlt(_localctx, 7); + { + State = 483; _localctx.TreeSelector = Match(TREE_SELECTOR); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class IdentifierContext : ParserRuleContext { + public IToken Id; + public ITerminalNode ID() { return GetToken(MetaCodeParser.ID, 0); } + public IdentifierContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_identifier; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterIdentifier(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitIdentifier(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitIdentifier(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public IdentifierContext identifier() { + IdentifierContext _localctx = new IdentifierContext(_ctx, State); + EnterRule(_localctx, 54, RULE_identifier); + try { + EnterOuterAlt(_localctx, 1); + { + State = 486; _localctx.Id = Match(ID); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class NumberConstantContext : ParserRuleContext { + public ITerminalNode NUMBER() { return GetToken(MetaCodeParser.NUMBER, 0); } + public NumberConstantContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_numberConstant; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterNumberConstant(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitNumberConstant(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitNumberConstant(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public NumberConstantContext numberConstant() { + NumberConstantContext _localctx = new NumberConstantContext(_ctx, State); + EnterRule(_localctx, 56, RULE_numberConstant); + try { + EnterOuterAlt(_localctx, 1); + { + State = 488; Match(NUMBER); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class StringConstantContext : ParserRuleContext { + public ITerminalNode STRING() { return GetToken(MetaCodeParser.STRING, 0); } + public StringConstantContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_stringConstant; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterStringConstant(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitStringConstant(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitStringConstant(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public StringConstantContext stringConstant() { + StringConstantContext _localctx = new StringConstantContext(_ctx, State); + EnterRule(_localctx, 58, RULE_stringConstant); + try { + EnterOuterAlt(_localctx, 1); + { + State = 490; Match(STRING); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class BooleanConstantContext : ParserRuleContext { + public ITerminalNode BOOLEAN() { return GetToken(MetaCodeParser.BOOLEAN, 0); } + public BooleanConstantContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_booleanConstant; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterBooleanConstant(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitBooleanConstant(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitBooleanConstant(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public BooleanConstantContext booleanConstant() { + BooleanConstantContext _localctx = new BooleanConstantContext(_ctx, State); + EnterRule(_localctx, 60, RULE_booleanConstant); + try { + EnterOuterAlt(_localctx, 1); + { + State = 492; Match(BOOLEAN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ArrayConstantContext : ParserRuleContext { + public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + public IReadOnlyList expression() { + return GetRuleContexts(); + } + public ArrayConstantContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_arrayConstant; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterArrayConstant(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitArrayConstant(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitArrayConstant(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ArrayConstantContext arrayConstant() { + ArrayConstantContext _localctx = new ArrayConstantContext(_ctx, State); + EnterRule(_localctx, 62, RULE_arrayConstant); + int _la; + try { + State = 507; + switch ( Interpreter.AdaptivePredict(_input,47,_ctx) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 494; Match(8); + State = 495; expression(0); + State = 500; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 496; Match(3); + State = 497; expression(0); + } + } + State = 502; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 503; Match(1); + } + break; + + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 505; Match(8); + State = 506; Match(1); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class IntervalConstantContext : ParserRuleContext { + public IToken Start; + public IToken End; + public IToken By; + public ITerminalNode NUMBER(int i) { + return GetToken(MetaCodeParser.NUMBER, i); + } + public IReadOnlyList NUMBER() { return GetTokens(MetaCodeParser.NUMBER); } + public IntervalConstantContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_intervalConstant; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterIntervalConstant(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitIntervalConstant(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitIntervalConstant(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public IntervalConstantContext intervalConstant() { + IntervalConstantContext _localctx = new IntervalConstantContext(_ctx, State); + EnterRule(_localctx, 64, RULE_intervalConstant); + try { + EnterOuterAlt(_localctx, 1); + { + State = 509; _localctx.Start = Match(NUMBER); + State = 510; Match(15); + State = 511; _localctx.End = Match(NUMBER); + State = 514; + switch ( Interpreter.AdaptivePredict(_input,48,_ctx) ) { + case 1: + { + State = 512; Match(17); + State = 513; _localctx.By = Match(NUMBER); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class AttributeContext : ParserRuleContext { + public IToken Name; + public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + public IReadOnlyList expression() { + return GetRuleContexts(); + } + public ITerminalNode ATTRIBUTE_ID() { return GetToken(MetaCodeParser.ATTRIBUTE_ID, 0); } + public AttributeContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_attribute; } + public override void EnterRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.EnterAttribute(this); + } + public override void ExitRule(IParseTreeListener listener) { + IMetaCodeListener typedListener = listener as IMetaCodeListener; + if (typedListener != null) typedListener.ExitAttribute(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + IMetaCodeVisitor typedVisitor = visitor as IMetaCodeVisitor; + if (typedVisitor != null) return typedVisitor.VisitAttribute(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public AttributeContext attribute() { + AttributeContext _localctx = new AttributeContext(_ctx, State); + EnterRule(_localctx, 66, RULE_attribute); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 516; _localctx.Name = Match(ATTRIBUTE_ID); + State = 528; + switch ( Interpreter.AdaptivePredict(_input,50,_ctx) ) { + case 1: + { + State = 517; Match(LEFT_PARENTHESIS); + State = 518; expression(0); + State = 523; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 519; Match(3); + State = 520; expression(0); + } + } + State = 525; + _errHandler.Sync(this); + _la = _input.La(1); + } + State = 526; Match(RIGHT_PARENTHESIS); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public override bool Sempred(RuleContext _localctx, int ruleIndex, int predIndex) { + switch (ruleIndex) { + case 6: return expression_sempred((ExpressionContext)_localctx, predIndex); + } + return true; + } + private bool expression_sempred(ExpressionContext _localctx, int predIndex) { + switch (predIndex) { + case 0: return Precpred(_ctx, 12); + + case 1: return Precpred(_ctx, 11); + + case 2: return Precpred(_ctx, 10); + + case 3: return Precpred(_ctx, 9); + + case 4: return Precpred(_ctx, 8); + + case 5: return Precpred(_ctx, 7); + + case 6: return Precpred(_ctx, 6); + + case 7: return Precpred(_ctx, 5); + + case 8: return Precpred(_ctx, 4); + + case 9: return Precpred(_ctx, 3); + + case 10: return Precpred(_ctx, 2); + + case 11: return Precpred(_ctx, 1); + } + return true; + } + + public static readonly string _serializedATN = + "\x3\xAF6F\x8320\x479D\xB75C\x4880\x1605\x191C\xAB37\x3\x35\x215\x4\x2"+ + "\t\x2\x4\x3\t\x3\x4\x4\t\x4\x4\x5\t\x5\x4\x6\t\x6\x4\a\t\a\x4\b\t\b\x4"+ + "\t\t\t\x4\n\t\n\x4\v\t\v\x4\f\t\f\x4\r\t\r\x4\xE\t\xE\x4\xF\t\xF\x4\x10"+ + "\t\x10\x4\x11\t\x11\x4\x12\t\x12\x4\x13\t\x13\x4\x14\t\x14\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3\x12\x3\x12\x3\x13\x3\x13\x3"+ + "\x14\x3\x14\x3\x14\x3\x15\x3\x15\x3\x15\x3\x15\a\x15\x180\n\x15\f\x15"+ + "\xE\x15\x183\v\x15\x3\x15\x3\x15\x3\x15\x3\x15\x3\x15\x5\x15\x18A\n\x15"+ + "\x3\x15\x3\x15\x3\x15\x3\x15\a\x15\x190\n\x15\f\x15\xE\x15\x193\v\x15"+ + "\x3\x15\x3\x15\x3\x15\x3\x15\x3\x15\x5\x15\x19A\n\x15\x5\x15\x19C\n\x15"+ + "\x3\x16\a\x16\x19F\n\x16\f\x16\xE\x16\x1A2\v\x16\x3\x16\x3\x16\x3\x16"+ + "\x3\x16\x3\x16\x3\x16\a\x16\x1AA\n\x16\f\x16\xE\x16\x1AD\v\x16\x3\x16"+ + "\x3\x16\x5\x16\x1B1\n\x16\x3\x16\x3\x16\x3\x17\x3\x17\x3\x17\x3\x17\x3"+ + "\x17\x3\x17\x3\x17\x3\x18\a\x18\x1BD\n\x18\f\x18\xE\x18\x1C0\v\x18\x3"+ + "\x18\x3\x18\x3\x18\x3\x18\x3\x19\x3\x19\x3\x19\x3\x19\x3\x1A\x3\x1A\x3"+ + "\x1A\a\x1A\x1CD\n\x1A\f\x1A\xE\x1A\x1D0\v\x1A\x3\x1B\a\x1B\x1D3\n\x1B"+ + "\f\x1B\xE\x1B\x1D6\v\x1B\x3\x1B\x3\x1B\x3\x1B\a\x1B\x1DB\n\x1B\f\x1B\xE"+ + "\x1B\x1DE\v\x1B\x3\x1C\x3\x1C\x3\x1C\x3\x1C\x3\x1C\x3\x1C\x3\x1C\x5\x1C"+ + "\x1E7\n\x1C\x3\x1D\x3\x1D\x3\x1E\x3\x1E\x3\x1F\x3\x1F\x3 \x3 \x3!\x3!"+ + "\x3!\x3!\a!\x1F5\n!\f!\xE!\x1F8\v!\x3!\x3!\x3!\x3!\x5!\x1FE\n!\x3\"\x3"+ + "\"\x3\"\x3\"\x3\"\x5\"\x205\n\"\x3#\x3#\x3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2\xFD\x100\x3\x2\x2\x2\xFE"+ + "\xFC\x3\x2\x2\x2\xFE\xFF\x3\x2\x2\x2\xFF\x101\x3\x2\x2\x2\x100\xFE\x3"+ + "\x2\x2\x2\x101\x114\a-\x2\x2\x102\x104\x5\x44#\x2\x103\x102\x3\x2\x2\x2"+ + "\x104\x107\x3\x2\x2\x2\x105\x103\x3\x2\x2\x2\x105\x106\x3\x2\x2\x2\x106"+ + "\x108\x3\x2\x2\x2\x107\x105\x3\x2\x2\x2\x108\x114\x5(\x15\x2\x109\x10B"+ + "\x5\x44#\x2\x10A\x109\x3\x2\x2\x2\x10B\x10E\x3\x2\x2\x2\x10C\x10A\x3\x2"+ + "\x2\x2\x10C\x10D\x3\x2\x2\x2\x10D\x10F\x3\x2\x2\x2\x10E\x10C\x3\x2\x2"+ + "\x2\x10F\x110\a+\x2\x2\x110\x111\x5\xE\b\x2\x111\x112\a,\x2\x2\x112\x114"+ + "\x3\x2\x2\x2\x113\xF7\x3\x2\x2\x2\x113\xFE\x3\x2\x2\x2\x113\x105\x3\x2"+ + "\x2\x2\x113\x10C\x3\x2\x2\x2\x114\x19\x3\x2\x2\x2\x115\x117\x5\x44#\x2"+ + "\x116\x115\x3\x2\x2\x2\x117\x11A\x3\x2\x2\x2\x118\x116\x3\x2\x2\x2\x118"+ + "\x119\x3\x2\x2\x2\x119\x11B\x3\x2\x2\x2\x11A\x118\x3\x2\x2\x2\x11B\x11C"+ + "\a\x17\x2\x2\x11C\x128\a-\x2\x2\x11D\x11E\a+\x2\x2\x11E\x123\x5.\x18\x2"+ + "\x11F\x120\a\x5\x2\x2\x120\x122\x5.\x18\x2\x121\x11F\x3\x2\x2\x2\x122"+ + "\x125\x3\x2\x2\x2\x123\x121\x3\x2\x2\x2\x123\x124\x3\x2\x2\x2\x124\x126"+ + "\x3\x2\x2\x2\x125\x123\x3\x2\x2\x2\x126\x127\a,\x2\x2\x127\x129\x3\x2"+ + "\x2\x2\x128\x11D\x3\x2\x2\x2\x128\x129\x3\x2\x2\x2\x129\x12A\x3\x2\x2"+ + "\x2\x12A\x12B\a\v\x2\x2\x12B\x12C\x5\x34\x1B\x2\x12C\x12D\x3\x2\x2\x2"+ + "\x12D\x12E\a\x1C\x2\x2\x12E\x12F\x5\x4\x3\x2\x12F\x130\a\x1D\x2\x2\x130"+ + "\x1B\x3\x2\x2\x2\x131\x133\x5\x44#\x2\x132\x131\x3\x2\x2\x2\x133\x136"+ + "\x3\x2\x2\x2\x134\x132\x3\x2\x2\x2\x134\x135\x3\x2\x2\x2\x135\x137\x3"+ + "\x2\x2\x2\x136\x134\x3\x2\x2\x2\x137\x138\a!\x2\x2\x138\x139\a-\x2\x2"+ + "\x139\x13A\a+\x2\x2\x13A\x13F\x5\x30\x19\x2\x13B\x13C\a\x5\x2\x2\x13C"+ + "\x13E\x5\x30\x19\x2\x13D\x13B\x3\x2\x2\x2\x13E\x141\x3\x2\x2\x2\x13F\x13D"+ + "\x3\x2\x2\x2\x13F\x140\x3\x2\x2\x2\x140\x142\x3\x2\x2\x2\x141\x13F\x3"+ + "\x2\x2\x2\x142\x143\a,\x2\x2\x143\x144\a\x1C\x2\x2\x144\x145\x5\x4\x3"+ + "\x2\x145\x146\a\x1D\x2\x2\x146\x1D\x3\x2\x2\x2\x147\x149\x5\x44#\x2\x148"+ + "\x147\x3\x2\x2\x2\x149\x14C\x3\x2\x2\x2\x14A\x148\x3\x2\x2\x2\x14A\x14B"+ + "\x3\x2\x2\x2\x14B\x14D\x3\x2\x2\x2\x14C\x14A\x3\x2\x2\x2\x14D\x14E\a\x18"+ + "\x2\x2\x14E\x14F\a+\x2\x2\x14F\x150\a#\x2\x2\x150\x151\a-\x2\x2\x151\x152"+ + "\a\v\x2\x2\x152\x153\x5\x34\x1B\x2\x153\x154\x3\x2\x2\x2\x154\x155\a$"+ + "\x2\x2\x155\x156\x5\xE\b\x2\x156\x157\a,\x2\x2\x157\x158\x5\x6\x4\x2\x158"+ + "\x1F\x3\x2\x2\x2\x159\x15B\x5\x44#\x2\x15A\x159\x3\x2\x2\x2\x15B\x15E"+ + "\x3\x2\x2\x2\x15C\x15A\x3\x2\x2\x2\x15C\x15D\x3\x2\x2\x2\x15D\x15F\x3"+ + "\x2\x2\x2\x15E\x15C\x3\x2\x2\x2\x15F\x160\a\x19\x2\x2\x160\x161\a+\x2"+ + "\x2\x161\x162\x5\xE\b\x2\x162\x163\a,\x2\x2\x163\x164\x5\x6\x4\x2\x164"+ + "!\x3\x2\x2\x2\x165\x167\x5\x44#\x2\x166\x165\x3\x2\x2\x2\x167\x16A\x3"+ + "\x2\x2\x2\x168\x166\x3\x2\x2\x2\x168\x169\x3\x2\x2\x2\x169\x16B\x3\x2"+ + "\x2\x2\x16A\x168\x3\x2\x2\x2\x16B\x171\a\x1C\x2\x2\x16C\x16D\x5\x6\x4"+ + "\x2\x16D\x16E\a\xF\x2\x2\x16E\x170\x3\x2\x2\x2\x16F\x16C\x3\x2\x2\x2\x170"+ + "\x173\x3\x2\x2\x2\x171\x16F\x3\x2\x2\x2\x171\x172\x3\x2\x2\x2\x172\x174"+ + "\x3\x2\x2\x2\x173\x171\x3\x2\x2\x2\x174\x175\a\x1D\x2\x2\x175#\x3\x2\x2"+ + "\x2\x176\x177\a\"\x2\x2\x177%\x3\x2\x2\x2\x178\x179\a*\x2\x2\x179\x17A"+ + "\x5\xE\b\x2\x17A\'\x3\x2\x2\x2\x17B\x17C\x5\x14\v\x2\x17C\x17D\a%\x2\x2"+ + "\x17D\x189\x5\xE\b\x2\x17E\x180\x5\x44#\x2\x17F\x17E\x3\x2\x2\x2\x180"+ + "\x183\x3\x2\x2\x2\x181\x17F\x3\x2\x2\x2\x181\x182\x3\x2\x2\x2\x182\x184"+ + "\x3\x2\x2\x2\x183\x181\x3\x2\x2\x2\x184\x185\a\x1A\x2\x2\x185\x186\a+"+ + "\x2\x2\x186\x187\x5\xE\b\x2\x187\x188\a,\x2\x2\x188\x18A\x3\x2\x2\x2\x189"+ + "\x181\x3\x2\x2\x2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\x205\a\x33\x2\x2\x204\x202\x3\x2\x2\x2"+ + "\x204\x205\x3\x2\x2\x2\x205\x43\x3\x2\x2\x2\x206\x212\a\x31\x2\x2\x207"+ + "\x208\a+\x2\x2\x208\x20D\x5\xE\b\x2\x209\x20A\a\x5\x2\x2\x20A\x20C\x5"+ + "\xE\b\x2\x20B\x209\x3\x2\x2\x2\x20C\x20F\x3\x2\x2\x2\x20D\x20B\x3\x2\x2"+ + "\x2\x20D\x20E\x3\x2\x2\x2\x20E\x210\x3\x2\x2\x2\x20F\x20D\x3\x2\x2\x2"+ + "\x210\x211\a,\x2\x2\x211\x213\x3\x2\x2\x2\x212\x207\x3\x2\x2\x2\x212\x213"+ + "\x3\x2\x2\x2\x213\x45\x3\x2\x2\x2\x35M[`gkp{\x80\x85\x8F\x9A\xC0\xC2\xCC"+ + "\xD4\xDE\xE7\xEE\xF2\xF7\xFE\x105\x10C\x113\x118\x123\x128\x134\x13F\x14A"+ + "\x15C\x168\x171\x181\x189\x191\x199\x19B\x1A0\x1AB\x1B0\x1BE\x1CE\x1D4"+ + "\x1DC\x1E6\x1F6\x1FD\x204\x20D\x212"; + public static readonly ATN _ATN = + new ATNDeserializer().Deserialize(_serializedATN.ToCharArray()); +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeVisitor.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeVisitor.cs new file mode 100644 index 0000000..9053ed2 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/MetaCodeVisitor.cs @@ -0,0 +1,271 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\MetaCode.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using IToken = Antlr4.Runtime.IToken; + +/// +/// This interface defines a complete generic visitor for a parse tree produced +/// by . +/// +/// The return type of the visit operation. +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public interface IMetaCodeVisitor : IParseTreeVisitor { + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitExpression([NotNull] MetaCodeParser.ExpressionContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitFormalParameter([NotNull] MetaCodeParser.FormalParameterContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitReturnStatement([NotNull] MetaCodeParser.ReturnStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitAttribute([NotNull] MetaCodeParser.AttributeContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitBlockStatement([NotNull] MetaCodeParser.BlockStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitIntervalConstant([NotNull] MetaCodeParser.IntervalConstantContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitPrimaryExpression([NotNull] MetaCodeParser.PrimaryExpressionContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMacroCallExpression([NotNull] MetaCodeParser.MacroCallExpressionContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitAttributeDeclaration([NotNull] MetaCodeParser.AttributeDeclarationContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitElseIfStatement([NotNull] MetaCodeParser.ElseIfStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitVariableDeclaration([NotNull] MetaCodeParser.VariableDeclarationContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitFunctionStatement([NotNull] MetaCodeParser.FunctionStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitStatements([NotNull] MetaCodeParser.StatementsContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMacroFormalParameter([NotNull] MetaCodeParser.MacroFormalParameterContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitActualParameterList([NotNull] MetaCodeParser.ActualParameterListContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSkipStatement([NotNull] MetaCodeParser.SkipStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitConstant([NotNull] MetaCodeParser.ConstantContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitBooleanConstant([NotNull] MetaCodeParser.BooleanConstantContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMemberTagExpression([NotNull] MetaCodeParser.MemberTagExpressionContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitAssignmentExpression([NotNull] MetaCodeParser.AssignmentExpressionContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInit([NotNull] MetaCodeParser.InitContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitNumberConstant([NotNull] MetaCodeParser.NumberConstantContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitIfStatement([NotNull] MetaCodeParser.IfStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitTypeName([NotNull] MetaCodeParser.TypeNameContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMemberExpression([NotNull] MetaCodeParser.MemberExpressionContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitObjectDeclaration([NotNull] MetaCodeParser.ObjectDeclarationContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitStatement([NotNull] MetaCodeParser.StatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitWhileStatement([NotNull] MetaCodeParser.WhileStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMacroStatement([NotNull] MetaCodeParser.MacroStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitFunctionCallExpression([NotNull] MetaCodeParser.FunctionCallExpressionContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitArrayConstant([NotNull] MetaCodeParser.ArrayConstantContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitForeachStatement([NotNull] MetaCodeParser.ForeachStatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitStringConstant([NotNull] MetaCodeParser.StringConstantContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitIdentifier([NotNull] MetaCodeParser.IdentifierContext context); +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorBaseListener.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorBaseListener.cs new file mode 100644 index 0000000..05c7a6a --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorBaseListener.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\TreeSelector.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { + +using Antlr4.Runtime.Misc; +using IErrorNode = Antlr4.Runtime.Tree.IErrorNode; +using ITerminalNode = Antlr4.Runtime.Tree.ITerminalNode; +using IToken = Antlr4.Runtime.IToken; +using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; + +/// +/// This class provides an empty implementation of , +/// which can be extended to create a listener which only needs to handle a subset +/// of the available methods. +/// +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class TreeSelectorBaseListener : ITreeSelectorListener { + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterStatement([NotNull] TreeSelectorParser.StatementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitStatement([NotNull] TreeSelectorParser.StatementContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterSelector([NotNull] TreeSelectorParser.SelectorContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitSelector([NotNull] TreeSelectorParser.SelectorContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterSelectors([NotNull] TreeSelectorParser.SelectorsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitSelectors([NotNull] TreeSelectorParser.SelectorsContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterAttribute([NotNull] TreeSelectorParser.AttributeContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitAttribute([NotNull] TreeSelectorParser.AttributeContext context) { } + + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInit([NotNull] TreeSelectorParser.InitContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInit([NotNull] TreeSelectorParser.InitContext context) { } + + /// + /// The default implementation does nothing. + public virtual void EnterEveryRule([NotNull] ParserRuleContext context) { } + /// + /// The default implementation does nothing. + public virtual void ExitEveryRule([NotNull] ParserRuleContext context) { } + /// + /// The default implementation does nothing. + public virtual void VisitTerminal([NotNull] ITerminalNode node) { } + /// + /// The default implementation does nothing. + public virtual void VisitErrorNode([NotNull] IErrorNode node) { } +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorBaseVisitor.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorBaseVisitor.cs new file mode 100644 index 0000000..c526084 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorBaseVisitor.cs @@ -0,0 +1,90 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\TreeSelector.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using IToken = Antlr4.Runtime.IToken; +using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; + +/// +/// This class provides an empty implementation of , +/// which can be extended to create a visitor which only needs to handle a subset +/// of the available methods. +/// +/// The return type of the visit operation. +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class TreeSelectorBaseVisitor : AbstractParseTreeVisitor, ITreeSelectorVisitor { + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitStatement([NotNull] TreeSelectorParser.StatementContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSelector([NotNull] TreeSelectorParser.SelectorContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSelectors([NotNull] TreeSelectorParser.SelectorsContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAttribute([NotNull] TreeSelectorParser.AttributeContext context) { return VisitChildren(context); } + + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInit([NotNull] TreeSelectorParser.InitContext context) { return VisitChildren(context); } +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorLexer.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorLexer.cs new file mode 100644 index 0000000..9d32266 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorLexer.cs @@ -0,0 +1,95 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\TreeSelector.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime; +using Antlr4.Runtime.Atn; +using Antlr4.Runtime.Misc; +using DFA = Antlr4.Runtime.Dfa.DFA; + +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class TreeSelectorLexer : Lexer { + public const int + T__5=1, T__4=2, T__3=3, T__2=4, T__1=5, T__0=6, OPERATOR=7, ID=8, WHITESPACE=9, + NEWLINE=10; + public static string[] modeNames = { + "DEFAULT_MODE" + }; + + public static readonly string[] tokenNames = { + "", + "']'", "'{'", "','", "'['", "'='", "'}'", "OPERATOR", "ID", "WHITESPACE", + "NEWLINE" + }; + public static readonly string[] ruleNames = { + "T__5", "T__4", "T__3", "T__2", "T__1", "T__0", "OPERATOR", "ID", "LETTER", + "WHITESPACE", "NEWLINE" + }; + + + public TreeSelectorLexer(ICharStream input) + : base(input) + { + _interp = new LexerATNSimulator(this,_ATN); + } + + public override string GrammarFileName { get { return "TreeSelector.g4"; } } + + public override string[] TokenNames { get { return tokenNames; } } + + public override string[] RuleNames { get { return ruleNames; } } + + public override string[] ModeNames { get { return modeNames; } } + + public override string SerializedAtn { get { return _serializedATN; } } + + public static readonly string _serializedATN = + "\x3\xAF6F\x8320\x479D\xB75C\x4880\x1605\x191C\xAB37\x2\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x6\x3\x2\x2"+ + "\x2\x1D\x1E\a.\x2\x2\x1E\b\x3\x2\x2\x2\x1F \a]\x2\x2 \n\x3\x2\x2\x2!\""+ + "\a?\x2\x2\"\f\x3\x2\x2\x2#$\a\x7F\x2\x2$\xE\x3\x2\x2\x2%&\t\x2\x2\x2&"+ + "\x10\x3\x2\x2\x2\')\a\x42\x2\x2(\'\x3\x2\x2\x2()\x3\x2\x2\x2),\x3\x2\x2"+ + "\x2*-\x5\x13\n\x2+-\a\x61\x2\x2,*\x3\x2\x2\x2,+\x3\x2\x2\x2-\x32\x3\x2"+ + "\x2\x2.\x31\x5\x13\n\x2/\x31\t\x3\x2\x2\x30.\x3\x2\x2\x2\x30/\x3\x2\x2"+ + "\x2\x31\x34\x3\x2\x2\x2\x32\x30\x3\x2\x2\x2\x32\x33\x3\x2\x2\x2\x33\x37"+ + "\x3\x2\x2\x2\x34\x32\x3\x2\x2\x2\x35\x37\a,\x2\x2\x36(\x3\x2\x2\x2\x36"+ + "\x35\x3\x2\x2\x2\x37\x12\x3\x2\x2\x2\x38\x39\t\x4\x2\x2\x39\x14\x3\x2"+ + "\x2\x2:<\t\x5\x2\x2;:\x3\x2\x2\x2<=\x3\x2\x2\x2=;\x3\x2\x2\x2=>\x3\x2"+ + "\x2\x2>?\x3\x2\x2\x2?@\b\v\x2\x2@\x16\x3\x2\x2\x2\x41\x43\a\xF\x2\x2\x42"+ + "\x41\x3\x2\x2\x2\x42\x43\x3\x2\x2\x2\x43\x44\x3\x2\x2\x2\x44\x45\a\f\x2"+ + "\x2\x45\x46\x3\x2\x2\x2\x46G\b\f\x2\x2G\x18\x3\x2\x2\x2\n\x2(,\x30\x32"+ + "\x36=\x42\x3\b\x2\x2"; + public static readonly ATN _ATN = + new ATNDeserializer().Deserialize(_serializedATN.ToCharArray()); +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorListener.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorListener.cs new file mode 100644 index 0000000..4a0f522 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorListener.cs @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\TreeSelector.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime.Misc; +using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener; +using IToken = Antlr4.Runtime.IToken; + +/// +/// This interface defines a complete listener for a parse tree produced by +/// . +/// +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public interface ITreeSelectorListener : IParseTreeListener { + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterStatement([NotNull] TreeSelectorParser.StatementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitStatement([NotNull] TreeSelectorParser.StatementContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterSelector([NotNull] TreeSelectorParser.SelectorContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitSelector([NotNull] TreeSelectorParser.SelectorContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterSelectors([NotNull] TreeSelectorParser.SelectorsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitSelectors([NotNull] TreeSelectorParser.SelectorsContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterAttribute([NotNull] TreeSelectorParser.AttributeContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitAttribute([NotNull] TreeSelectorParser.AttributeContext context); + + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInit([NotNull] TreeSelectorParser.InitContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInit([NotNull] TreeSelectorParser.InitContext context); +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorParser.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorParser.cs new file mode 100644 index 0000000..a555e31 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorParser.cs @@ -0,0 +1,383 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\TreeSelector.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime; +using Antlr4.Runtime.Atn; +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using System.Collections.Generic; +using DFA = Antlr4.Runtime.Dfa.DFA; + +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public partial class TreeSelectorParser : Parser { + public const int + T__5=1, T__4=2, T__3=3, T__2=4, T__1=5, T__0=6, OPERATOR=7, ID=8, WHITESPACE=9, + NEWLINE=10; + public static readonly string[] tokenNames = { + "", "']'", "'{'", "','", "'['", "'='", "'}'", "OPERATOR", "ID", + "WHITESPACE", "NEWLINE" + }; + public const int + RULE_init = 0, RULE_selectors = 1, RULE_selector = 2, RULE_attribute = 3, + RULE_statement = 4; + public static readonly string[] ruleNames = { + "init", "selectors", "selector", "attribute", "statement" + }; + + public override string GrammarFileName { get { return "TreeSelector.g4"; } } + + public override string[] TokenNames { get { return tokenNames; } } + + public override string[] RuleNames { get { return ruleNames; } } + + public override string SerializedAtn { get { return _serializedATN; } } + + public TreeSelectorParser(ITokenStream input) + : base(input) + { + _interp = new ParserATNSimulator(this,_ATN); + } + public partial class InitContext : ParserRuleContext { + public SelectorsContext selectors() { + return GetRuleContext(0); + } + public InitContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_init; } + public override void EnterRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.EnterInit(this); + } + public override void ExitRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.ExitInit(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + ITreeSelectorVisitor typedVisitor = visitor as ITreeSelectorVisitor; + if (typedVisitor != null) return typedVisitor.VisitInit(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InitContext init() { + InitContext _localctx = new InitContext(_ctx, State); + EnterRule(_localctx, 0, RULE_init); + try { + EnterOuterAlt(_localctx, 1); + { + State = 10; Match(2); + State = 11; selectors(); + State = 12; Match(6); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class SelectorsContext : ParserRuleContext { + public SelectorContext selector(int i) { + return GetRuleContext(i); + } + public IReadOnlyList selector() { + return GetRuleContexts(); + } + public SelectorsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_selectors; } + public override void EnterRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.EnterSelectors(this); + } + public override void ExitRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.ExitSelectors(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + ITreeSelectorVisitor typedVisitor = visitor as ITreeSelectorVisitor; + if (typedVisitor != null) return typedVisitor.VisitSelectors(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public SelectorsContext selectors() { + SelectorsContext _localctx = new SelectorsContext(_ctx, State); + EnterRule(_localctx, 2, RULE_selectors); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 14; selector(); + State = 19; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==3) { + { + { + State = 15; Match(3); + State = 16; selector(); + } + } + State = 21; + _errHandler.Sync(this); + _la = _input.La(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class SelectorContext : ParserRuleContext { + public StatementContext Parent; + public IToken Operator; + public SelectorContext Child; + public StatementContext statement() { + return GetRuleContext(0); + } + public SelectorContext selector() { + return GetRuleContext(0); + } + public ITerminalNode OPERATOR() { return GetToken(TreeSelectorParser.OPERATOR, 0); } + public SelectorContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_selector; } + public override void EnterRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.EnterSelector(this); + } + public override void ExitRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.ExitSelector(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + ITreeSelectorVisitor typedVisitor = visitor as ITreeSelectorVisitor; + if (typedVisitor != null) return typedVisitor.VisitSelector(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public SelectorContext selector() { + SelectorContext _localctx = new SelectorContext(_ctx, State); + EnterRule(_localctx, 4, RULE_selector); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 22; _localctx.Parent = statement(); + State = 27; + _la = _input.La(1); + if (_la==OPERATOR || _la==ID) { + { + State = 24; + _la = _input.La(1); + if (_la==OPERATOR) { + { + State = 23; _localctx.Operator = Match(OPERATOR); + } + } + + State = 26; _localctx.Child = selector(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class AttributeContext : ParserRuleContext { + public IToken Property; + public IToken Value; + public IReadOnlyList ID() { return GetTokens(TreeSelectorParser.ID); } + public ITerminalNode ID(int i) { + return GetToken(TreeSelectorParser.ID, i); + } + public AttributeContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_attribute; } + public override void EnterRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.EnterAttribute(this); + } + public override void ExitRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.ExitAttribute(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + ITreeSelectorVisitor typedVisitor = visitor as ITreeSelectorVisitor; + if (typedVisitor != null) return typedVisitor.VisitAttribute(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public AttributeContext attribute() { + AttributeContext _localctx = new AttributeContext(_ctx, State); + EnterRule(_localctx, 6, RULE_attribute); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 29; Match(4); + State = 30; _localctx.Property = Match(ID); + State = 33; + _la = _input.La(1); + if (_la==5) { + { + State = 31; Match(5); + State = 32; _localctx.Value = Match(ID); + } + } + + State = 35; Match(1); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class StatementContext : ParserRuleContext { + public IToken Selector; + public AttributeContext Attributes; + public IReadOnlyList attribute() { + return GetRuleContexts(); + } + public ITerminalNode ID() { return GetToken(TreeSelectorParser.ID, 0); } + public AttributeContext attribute(int i) { + return GetRuleContext(i); + } + public StatementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int GetRuleIndex() { return RULE_statement; } + public override void EnterRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.EnterStatement(this); + } + public override void ExitRule(IParseTreeListener listener) { + ITreeSelectorListener typedListener = listener as ITreeSelectorListener; + if (typedListener != null) typedListener.ExitStatement(this); + } + public override TResult Accept(IParseTreeVisitor visitor) { + ITreeSelectorVisitor typedVisitor = visitor as ITreeSelectorVisitor; + if (typedVisitor != null) return typedVisitor.VisitStatement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public StatementContext statement() { + StatementContext _localctx = new StatementContext(_ctx, State); + EnterRule(_localctx, 8, RULE_statement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 37; _localctx.Selector = Match(ID); + State = 41; + _errHandler.Sync(this); + _la = _input.La(1); + while (_la==4) { + { + { + State = 38; _localctx.Attributes = attribute(); + } + } + State = 43; + _errHandler.Sync(this); + _la = _input.La(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.ReportError(this, re); + _errHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public static readonly string _serializedATN = + "\x3\xAF6F\x8320\x479D\xB75C\x4880\x1605\x191C\xAB37\x3\f/\x4\x2\t\x2\x4"+ + "\x3\t\x3\x4\x4\t\x4\x4\x5\t\x5\x4\x6\t\x6\x3\x2\x3\x2\x3\x2\x3\x2\x3\x3"+ + "\x3\x3\x3\x3\a\x3\x14\n\x3\f\x3\xE\x3\x17\v\x3\x3\x4\x3\x4\x5\x4\x1B\n"+ + "\x4\x3\x4\x5\x4\x1E\n\x4\x3\x5\x3\x5\x3\x5\x3\x5\x5\x5$\n\x5\x3\x5\x3"+ + "\x5\x3\x6\x3\x6\a\x6*\n\x6\f\x6\xE\x6-\v\x6\x3\x6\x2\x2\x2\a\x2\x2\x4"+ + "\x2\x6\x2\b\x2\n\x2\x2\x2.\x2\f\x3\x2\x2\x2\x4\x10\x3\x2\x2\x2\x6\x18"+ + "\x3\x2\x2\x2\b\x1F\x3\x2\x2\x2\n\'\x3\x2\x2\x2\f\r\a\x4\x2\x2\r\xE\x5"+ + "\x4\x3\x2\xE\xF\a\b\x2\x2\xF\x3\x3\x2\x2\x2\x10\x15\x5\x6\x4\x2\x11\x12"+ + "\a\x5\x2\x2\x12\x14\x5\x6\x4\x2\x13\x11\x3\x2\x2\x2\x14\x17\x3\x2\x2\x2"+ + "\x15\x13\x3\x2\x2\x2\x15\x16\x3\x2\x2\x2\x16\x5\x3\x2\x2\x2\x17\x15\x3"+ + "\x2\x2\x2\x18\x1D\x5\n\x6\x2\x19\x1B\a\t\x2\x2\x1A\x19\x3\x2\x2\x2\x1A"+ + "\x1B\x3\x2\x2\x2\x1B\x1C\x3\x2\x2\x2\x1C\x1E\x5\x6\x4\x2\x1D\x1A\x3\x2"+ + "\x2\x2\x1D\x1E\x3\x2\x2\x2\x1E\a\x3\x2\x2\x2\x1F \a\x6\x2\x2 #\a\n\x2"+ + "\x2!\"\a\a\x2\x2\"$\a\n\x2\x2#!\x3\x2\x2\x2#$\x3\x2\x2\x2$%\x3\x2\x2\x2"+ + "%&\a\x3\x2\x2&\t\x3\x2\x2\x2\'+\a\n\x2\x2(*\x5\b\x5\x2)(\x3\x2\x2\x2*"+ + "-\x3\x2\x2\x2+)\x3\x2\x2\x2+,\x3\x2\x2\x2,\v\x3\x2\x2\x2-+\x3\x2\x2\x2"+ + "\a\x15\x1A\x1D#+"; + public static readonly ATN _ATN = + new ATNDeserializer().Deserialize(_serializedATN.ToCharArray()); +} +} // namespace MetaCode.Compiler.Grammar diff --git a/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorVisitor.cs b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorVisitor.cs new file mode 100644 index 0000000..c106323 --- /dev/null +++ b/project/MetaCode/MetaCode.Compiler/obj/Release/TreeSelectorVisitor.cs @@ -0,0 +1,68 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// ANTLR Version: 4.2-SNAPSHOT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// Generated from E:\Development\Projects\MetaCode\project\MetaCode\MetaCode.Compiler\Grammar\TreeSelector.g4 by ANTLR 4.2-SNAPSHOT + +// Unreachable code detected +#pragma warning disable 0162 +// The variable '...' is assigned but its value is never used +#pragma warning disable 0219 +// Missing XML comment for publicly visible type or member '...' +#pragma warning disable 1591 + +namespace MetaCode.Compiler.Grammar { +using Antlr4.Runtime.Misc; +using Antlr4.Runtime.Tree; +using IToken = Antlr4.Runtime.IToken; + +/// +/// This interface defines a complete generic visitor for a parse tree produced +/// by . +/// +/// The return type of the visit operation. +[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.2-SNAPSHOT")] +[System.CLSCompliant(false)] +public interface ITreeSelectorVisitor : IParseTreeVisitor { + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitStatement([NotNull] TreeSelectorParser.StatementContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSelector([NotNull] TreeSelectorParser.SelectorContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSelectors([NotNull] TreeSelectorParser.SelectorsContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitAttribute([NotNull] TreeSelectorParser.AttributeContext context); + + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInit([NotNull] TreeSelectorParser.InitContext context); +} +} // namespace MetaCode.Compiler.Grammar