Giter Club home page Giter Club logo

Comments (12)

miklossy avatar miklossy commented on June 29, 2024 1

E.g. the parseTableData test case currently fails because the Cucumber.xtext grammar definines that a step description must start with either (WORD | NUMBER | STRING) . The test case processes a content with Given <foo> . <foo> is recognized as a PLACEHOLDER, so extending the grammar definition by (WORD | NUMBER | STRING | PLACEHOLDER) makes the parseTableData test case pass.

from natural.

drkstr101 avatar drkstr101 commented on June 29, 2024 1

Thanks for the assist on this one! We were able to incorporate the idea in the upcoming release. Cheers!

from natural.

rlogiacco avatar rlogiacco commented on June 29, 2024

from natural.

drkstr101 avatar drkstr101 commented on June 29, 2024

See: #43 (comment)

from natural.

miklossy avatar miklossy commented on June 29, 2024

See also a similar discussion in the Xtext forum.

from natural.

miklossy avatar miklossy commented on June 29, 2024

I think the most appropriate solution would be to allow any IDs for the keywords in the grammar and implement the validation / content assist in a way that it evaluates the first line of the *.feature file to determine the used language and validate / offer proposals accordingly.

From the Spoken Languages section of the Cucumber Gherkin documention:

A # language: header on the first line of a feature file specifies what spoken language to use.
For example # language: fr for French. If you omit this header, Cucumber will default to English (en).

When implementing like that, a change in the language specification would result in a lot of validation errors (since the used keywords are not valid any more). The editor should offer multi quickfixes available from Xtext 2.13 to fix all these problems in a single action.

from natural.

github-actions avatar github-actions commented on June 29, 2024

This issue has not been updated for a while: marking it as stale.

from natural.

drkstr101 avatar drkstr101 commented on June 29, 2024

@miklossy I just wanted to let you know I've been slowly plugging away at this in the background. My current challenge has been getting this to work with existing SL_COMMENT terminal rule which makes it hidden. I suppose I can work around this by grabbing the text from the parser rather than the AST, but I was hoping for a less finicky solution. Also step keywords need to be terminals or they clash with TEXT_LITERAL. I believe this last one may just be a mistake by mypart. I will keep you posted with any major developments on this front.

Edit: I just realized I can get rid of STEP_KEYWORD terminal entirely and simply match the first word, but how then to distinguish the end of the Narrative and beginning of the steps. Maybe we should simply treat this all as a generic bag of text lines at the parser level, then add a post-processing step to distinguish which lines are actually steps by referencing a table localized keywords (cucumber provides one in json form).

Thoughts?

from natural.

miklossy avatar miklossy commented on June 29, 2024

@cdietrich @szarnekow @kthoms Do you have any hints on this?

from natural.

drkstr101 avatar drkstr101 commented on June 29, 2024

One other idea I had is to implement a step in the generator to preprocess the json into a set of optional feature bundles for each locale. The goal wouldn;t be to reduce the bundle size but to keep the terminal rules to a minimum. I am making the assumption that performance scales poorly with n, where n is the number of terminal rules defined. I could be mistaken about this.

from natural.

drkstr101 avatar drkstr101 commented on June 29, 2024

@cdietrich @szarnekow @kthoms @miklossy

FYI the underlying work for this can be found in drkstr101/next

The current mission is to update the grammar to remove all ambiguities (generator warnings) so that it can be loaded and compiled in ANTLRWorks. The grammar in next does achieve this, but there is some parser regression in CucumberExamplesTest

@Test def void pathological_01() {
    assertExampleParses('''
        # language: en
        Feature: ASCII punctuation
        ,./;'[]\-=
        <>?:"{}|_+
        !@#$%^&*()`~
        
        Scenario:
        Given a step
    ''')
}

Specifically, It doesn't seem to like any symbols in the Narrative that are also used in keywords and/or terminals (@, :, ", and |). If anyone could offer some suggestions so that we can make some progress on this front, I believe all the rest will fall into place.

from natural.

miklossy avatar miklossy commented on June 29, 2024

Hello Aaron !

I have just checked out the current state of your branch and can execute the pathological_01() test case without any problem.

However, there are some other test cases failing on my machine:

screenshot

How is the current state on your machine?

from natural.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.