Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroneous syntax definition causes KeyNotFoundException #51

Open
ssrmm opened this issue Feb 14, 2017 · 2 comments
Open

Erroneous syntax definition causes KeyNotFoundException #51

ssrmm opened this issue Feb 14, 2017 · 2 comments

Comments

@ssrmm
Copy link
Contributor

ssrmm commented Feb 14, 2017

The following syntax definition produces a KeyNotFoundException during parsing:

namespace Test
{
  using Nitra.Core;

  syntax module TestSyntax
  {
    syntax Foo = Bar '+ Bar; // Note: The single quote is missing after the plus sign
    
    regex Bar = "Bar";
  }
}

The expected behaviour would be to get some parse errors instead.

@VladD2
Copy link
Member

VladD2 commented Feb 17, 2017

Can not reproduce.

@ssrmm
Copy link
Contributor Author

ssrmm commented Feb 17, 2017

I've originally been running this in the old visualizer, which didn't give me more information than the exception message. With the new visualizer I got the stacktrace from below. Also I got proper syntax highlighting and error messages

Based on that info it looks like the issue title isn't quiet correct. It's definitely not the parsing phase.

Pasting the code into the new visualizer should be sufficient to produce a message box continaing the exception text and stacktrace. However, my local repo currently isn't up to date with master. If you still can't reproduce it, I can try to get the latest version and see if it still happens there.


Project loading is failed in call RefreshProject().
Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Nitra.Ast.RuleFieldNameGenerator.GetName(Location loc, ParsedValue`1 desiredName) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\Members\RuleFieldNameGenerator.n:Line 66.
   at Nitra.Ast.RuleField.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\Members\RuleField.nitra:Line 27.
   at Nitra.Ast.RuleField.AstList.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\Members\RuleField.nitra:Line 0.
   at Nitra.Internal.AstUtils.EvalAmbiguitiesProperties(DependentPropertyEvalContext context, IAmbiguousAst ast) in D:\<...>\Nitra\Nitra\Nitra.Runtime\Declarations\AstUtils.n:Line 32.
   at Nitra.Declarations.AmbiguousAstList`1.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\Nitra.Runtime\Declarations\AstList.n:Line 135.
   at Nitra.Ast.TopSimpleRule.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\Members\SyntaxModuleMember\TopRule.nitra:Line 0.
   at Nitra.Ast.SyntaxModuleMember.AstList.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\Members\SyntaxModuleMember\SyntaxModuleMember.nitra:Line 0.
   at Nitra.Ast.SyntaxModule.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\SyntaxModule.nitra:Line 33.
   at DotNet.NamespaceMember.AstList.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\DotNetLang\Namespace\NamespaceMember.nitra:Line 0.
   at DotNet.ExplicitNamespace.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\DotNetLang\Namespace\Namespace.nitra:Line 49.
   at DotNet.NamespaceMember.AstList.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\DotNetLang\Namespace\NamespaceMember.nitra:Line 0.
   at DotNet.CompilationUnit.EvalProperties(DependentPropertyEvalContext context) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\DotNet\CompilationUnit.nitra:Line 10.
   at Nitra.Declarations.EvalPropertiesHost.EvalProperties(DependentPropertyEvalContext context, IDependentPropertyContainer obj, Single statistics) in D:\<...>\Nitra\Nitra\Nitra.Runtime\DependentProperties\EvalPropertiesHost.n:Line 66.
   at Nitra.Declarations.ProjectEvalPropertiesHost.ExecutePass(DependentPropertyEvalContext context, String passName) in D:\<...>\Nitra\Nitra\Nitra.Runtime\DependentProperties\ProjectEvalPropertiesHost.n:Line 47.
   at Nitra.Declarations.EvalPropertiesHost.EvalProperties(DependentPropertyEvalContext context, String passName, Int32 stage) in D:\<...>\Nitra\Nitra\Nitra.Runtime\DependentProperties\EvalPropertiesHost.n:Line 41.
   at DotNet.CompilationUnit.RefreshProject(CancellationToken cancellationToken, ImmutableArray`1 files, Object data) in D:\<...>\Nitra\Nitra\Nitra.Grammar\AST\DotNet\CompilationUnit.n:Line 103.
   at Nitra.ClientServer.Server.ParseWorker.ProcessMessage(ParserMessage msg) in D:\<...>\Nitra\Nitra\ClientServer\Nitra.ClientServer.Server\ParseWorker.n:Line 167.

@ssrmm ssrmm changed the title Exception when parsing erroneous syntax definition Erroneous syntax definition causes KeyNotFoundException Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants