question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ambigious path, how to solve this :)

See original GitHub issue

The problem I have a parameterlist like

void doSomething(boolean a, boolean b, boolean... list);

Only the last element can be this … which means it resolves to an array and the whole function cant ake infinitive booleans at the end. The problem is that everything looks the same only the last one is different, this is pretty hard to parse.

Ambiguous alternatives: <1 ,2> in <OR> inside <formalParameterList> Rule, <Identifier, ‘.’, Identifier, ‘[’> may appears as a prefix path in all these alternatives. To Resolve this, try one of of the following: 1. Refactor your grammar to be LL(K) for the current value of k (by default k=5) 2. Increase the value of K for your grammar by providing a larger ‘maxLookahead’ value in the parser’s config 3. This issue can be ignored (if you know what you are doing…), see http://sap.github.io/chevrotain/documentation/1_0_1/interfaces/_chevrotain_d_.iparserconfig.html#ignoredissues for more details

I get this error over on over… Can you help me to refactor this into something that works? Sorry I have no idea how. I dont wanna do 2. and 3. no I don’t know what I’m doing…

screen shot 2018-01-27 at 9 25 06 pm
// formalParameterList
    // : formalParameter (',' formalParameter)* (',' lastFormalParameter)?
    // | lastFormalParameter
    $.RULE("formalParameterList", () => {
      $.OR([
        {
          ALT: () => {
            $.SUBRULE($.formalParameter);
            $.MANY(() => {
              $.CONSUME(tokens.Comma);
              $.SUBRULE($.variableModifier);
            });
            $.OPTION(() => {
              $.CONSUME2(tokens.Comma);
              $.SUBRULE2($.lastFormalParameter);
            });
          }
        },
        {
          ALT: () => {
            $.SUBRULE3($.lastFormalParameter);
          }
        }
      ]);
    });

    // formalParameter
    // : variableModifier* typeType variableDeclaratorId
    $.RULE("formalParameter", () => {
      $.MANY(() => {
        $.SUBRULE($.variableModifier);
      });
      $.SUBRULE($.typeType);
      $.SUBRULE($.variableDeclaratorId);
    });

    // lastFormalParameter
    // : variableModifier* typeType '...' variableDeclaratorId
    $.RULE("lastFormalParameter", () => {
      $.MANY(() => {
        $.SUBRULE($.variableModifier);
      });
      $.SUBRULE($.typeType);
      $.CONSUME(tokens.DotDotDot);
      $.SUBRULE($.variableDeclaratorId);
    });

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
thorbenvh8commented, Jan 29, 2018

thank you, helped me again a lot. I will close this 😃

0reactions
bd82commented, Jan 28, 2018

I’m gonna implement the simple solution with a check in the visitor. Can you show me how you normally throw syntax errors? I want to keep it consistent 😃

https://github.com/SAP/chevrotain/blob/d4c904f2b143c4fb7b3bda0b891ce38e7d68c027/src/parse/parser_public.ts#L1829-L1831

The mismatchTokenException constructor is available on the public API. So your code will need to access it via:

require("chevrotain").exceptions.MismatchedTokenException

In the next version the API will be flattened, so it would be

require("chevrotain").MismatchedTokenException

-> Do you work at SAP? And can I send you a pizza or some beer for your help? 😃 Yes, I work for SAP, but I think the pizza would get cold as its over 10,000 kilometers between California and Israel 😄

btw you can also join the discord channel for random questions and discussions. https://discord.gg/J5Nx6r9

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Ambiguous paths between tables connection
I think the main reason is that the wrong activity relationship is set up. Generally speaking, there can only be one active relationship...
Read more >
7 Tips To Identify and Manage Ambiguity in the Workplace
7 tips for dealing with ambiguity · Plan for the future · Remain confident and calm · Accept change · Make decisions without...
Read more >
"Ambiguous paths" error when deploying tabular model ...
Fixes an "ambiguous paths" error when you deploy a tabular model database to an instance of Analysis Services in SQL Server 2016 or...
Read more >
How to manage ambiguous relationship in Power BI - Cloud BI
One solution is removing the relationship between Sales Territory and Sales (changing from Star to Snowflake):. There are 2 issues with this ...
Read more >
Resolving Ambiguous Paths Using BorderPatrol
Abstract. BorderPatrol successfully uses active observation to ob- tain precise causal paths as requests traverse many black- box modules, such as Apache, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found