Goldie Parsing System v0.4 Released - Now for D2

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Apr 15 14:46:43 PDT 2011


What I meant was that code like this will throw if MyType isn't
defined anywhere:

int main(int x)
{
    MyType var;
}

goldie.exception.UnexpectedTokenException at src\goldie\exception.d(35):
test.c(3:12): Unexpected Id: 'var'

It looks like valid C /syntax/, except that MyType isn't defined. But
this will work:
struct MyType {
       int field;
};
int main(int x)
{
    struct MyType var;
}

So either Goldie or ParseAnything needs to have all types defined.
Maybe this is obvious, but I wouldn't know since I've never used a
parser before. :p

Oddly enough, this one will throw:
typedef struct {
    int field;
} MyType;
int main(int x)
{
    MyType var;
}

goldie.exception.UnexpectedTokenException at src\goldie\exception.d(35):
test.c(7:12): Unexpected Id: 'var'

This one will throw as well:
struct SomeStruct {
    int field;
};
typedef struct SomeStruct MyType;
int main(int x)
{
    MyType var;
}

goldie.exception.UnexpectedTokenException at src\goldie\exception.d(35):
test.c(13:12): Unexpected Id: 'myvar'

Isn't typedef a part of ANSI C?


More information about the Digitalmars-d-announce mailing list