Skip to content

Escaping keyword in concrete pattern yields undeclared variable #1249

@kevinvandervlist

Description

@kevinvandervlist

As far as I could see this has not been reported yet.

module Weird

extend lang::std::Layout;
extend lang::std::Id;

import IO;

syntax C = c: Id type;

str a((C)`<Id tpe>`) = "<tpe>";

// Syntax error, unescaped keyword
// str b((C)`<Id type>`) = "<\type>";

// Syntax error, unescaped keyword
//str c((C)`<Id \type>`) = "<type>";

str d((C)`<Id \type>`) = "<\type>";

void main() {
    x = parse(#C, "foo");
    // This works as expected
    println(a(x));
    // this yields a runtime error
    println(d(x));
}

will produce:

rascal>import Weird;
ok
rascal>main();
foo
|project://Minos/src/Weird.rsc|(306,5,<18,27>,<18,32>): Undeclared variable: type
Advice: |http://tutor.rascal-mpl.org/Errors/Static/UndeclaredVariable/UndeclaredVariable.html|
ok

Shouldn't you be able to escape type like I do in d?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions