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

Grammar generation logs error with imports and types #1366

Open
cdietrich opened this issue Jan 31, 2024 · 1 comment
Open

Grammar generation logs error with imports and types #1366

cdietrich opened this issue Jan 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cdietrich
Copy link
Contributor

Create a new hello world grammar

change the hello-world.langium to

grammar HelloWorld

import './hello-metadata'

interface FieldValidation {
    field: @Field;
}

entry Validation: 
    'validate' name=ID '{'
        content+=FieldValidation*
    '}'
;

FieldValidation returns FieldValidation: 
    'on' field=[Field] '{' 
    '}';

create following additional grammars

hello-terminals.langium

hidden terminal WS: /\s+/;
terminal ID: /[_a-zA-Z][\w_-]*/;

hello-metadata.langium

grammar HelloMetadata

import './hello-terminals'

TextType infers DataType:
    name='Text';

BuiltInType:
    TextType;

Type:
    BuiltInType
;

interface Field {
    name: string;
    type: Type;
}

entry Field returns Field:
    'field' name=ID (type=Type) ('{' '}')?;

run langium:generate
the following error is logged to command line

Error: Token "Text" not found."

=> looks like there is something broken in the lexer building

@cdietrich cdietrich added the bug Something isn't working label Jan 31, 2024
@cdietrich
Copy link
Contributor Author

might be another wired variant of #1151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant