diff --git a/chore/llcppg/ast/ast.go b/chore/llcppg/ast/ast.go index 33a43181..27566722 100644 --- a/chore/llcppg/ast/ast.go +++ b/chore/llcppg/ast/ast.go @@ -16,6 +16,10 @@ package ast +import ( + "github.com/goplus/llgo/chore/llcppg/token" +) + // ============================================================================= type Node interface { @@ -44,6 +48,11 @@ type PPD interface { // preprocessing directive // ============================================================================= // Expressions (Types are also expressions) +type Token struct { + Token token.Token + Lit string +} + type BasicLitKind uint const ( @@ -293,6 +302,8 @@ func (*Include) ppdNode() {} // ------------------------------------------------ type Macro struct { + Name string + Info []*Token } func (*Macro) ppdNode() {} diff --git a/chore/llcppg/token/token.go b/chore/llcppg/token/token.go new file mode 100644 index 00000000..398919cc --- /dev/null +++ b/chore/llcppg/token/token.go @@ -0,0 +1,27 @@ +package token + +type Token uint + +const ( + /** + * A token that contains some kind of punctuation. + */ + PunctuationToken Token = iota + /** + * A language keyword. + */ + KeywordToken + + /** + * An identifier (that is not a keyword). + */ + IdentifierToken + /** + * A numeric, string, or character literal. + */ + LiteralToken + /** + * A comment. + */ + CommentToken +)