cc

package module
v0.0.0-...-d673e9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2018 License: BSD-3-Clause Imports: 21 Imported by: 0

README

github.com/cznic/cc has moved to modernc.org/cc (vcs).

Please update your import paths to modernc.org/cc.

This repo is now archived.

Documentation

Overview

Package cc is a C99 compiler front end.

Changelog

2018-07-01 This package is no longer maintained. Please see the v2 version at

https://github.com/cznic/cc/v2

Index

Examples

Constants

View Source
const (
	ADDASSIGN           = 57346
	ALIGNOF             = 57347
	ANDAND              = 57348
	ANDASSIGN           = 57349
	ARROW               = 57350
	ASM                 = 57351
	AUTO                = 57352
	BOOL                = 57353
	BREAK               = 57354
	CASE                = 57355
	CAST                = 57356
	CHAR                = 57357
	CHARCONST           = 57358
	COMPLEX             = 57359
	CONST               = 57360
	CONSTANT_EXPRESSION = 1048577
	CONTINUE            = 57361
	DDD                 = 57362
	DEC                 = 57363
	DEFAULT             = 57364
	DIVASSIGN           = 57365
	DO                  = 57366
	DOUBLE              = 57367
	ELSE                = 57368
	ENUM                = 57369
	EQ                  = 57370
	EXTERN              = 57371
	FLOAT               = 57372
	FLOATCONST          = 57373
	FOR                 = 57374
	GEQ                 = 57375
	GOTO                = 57376
	IDENTIFIER          = 57377
	IDENTIFIER_LPAREN   = 57378
	IDENTIFIER_NONREPL  = 57379
	IF                  = 57380
	INC                 = 57381
	INLINE              = 57382
	INT                 = 57383
	INTCONST            = 57384
	LEQ                 = 57385
	LONG                = 57386
	LONGCHARCONST       = 57387
	LONGSTRINGLITERAL   = 57388
	LSH                 = 57389
	LSHASSIGN           = 57390
	MODASSIGN           = 57391
	MULASSIGN           = 57392
	NEQ                 = 57393
	NOELSE              = 57394
	NORETURN            = 57395
	NOSEMI              = 57396
	ORASSIGN            = 57397
	OROR                = 57398
	PPDEFINE            = 57399
	PPELIF              = 57400
	PPELSE              = 57401
	PPENDIF             = 57402
	PPERROR             = 57403
	PPHASH_NL           = 57404
	PPHEADER_NAME       = 57405
	PPIF                = 57406
	PPIFDEF             = 57407
	PPIFNDEF            = 57408
	PPINCLUDE           = 57409
	PPINCLUDE_NEXT      = 57410
	PPLINE              = 57411
	PPNONDIRECTIVE      = 57412
	PPNUMBER            = 57413
	PPOTHER             = 57414
	PPPASTE             = 57415
	PPPRAGMA            = 57416
	PPUNDEF             = 57417
	PREPROCESSING_FILE  = 1048576
	REGISTER            = 57418
	RESTRICT            = 57419
	RETURN              = 57420
	RSH                 = 57421
	RSHASSIGN           = 57422
	SHORT               = 57423
	SIGNED              = 57424
	SIZEOF              = 57425
	STATIC              = 57426
	STATIC_ASSERT       = 57427
	STRINGLITERAL       = 57428
	STRUCT              = 57429
	SUBASSIGN           = 57430
	SWITCH              = 57431
	TRANSLATION_UNIT    = 1048578
	TYPEDEF             = 57432
	TYPEDEFNAME         = 57433
	TYPEOF              = 57434
	UNARY               = 57435
	UNION               = 57436
	UNSIGNED            = 57437
	VOID                = 57438
	VOLATILE            = 57439
	WHILE               = 57440
	XORASSIGN           = 57441
)

Variables

This section is empty.

Functions

func HostConfig

func HostConfig(opts ...string) (predefined string, includePaths, sysIncludePaths []string, err error)

HostConfig executes HostCppConfig with the cpp argument set to "cpp". For more info please see the documentation of HostCppConfig.

func HostCppConfig

func HostCppConfig(cpp string, opts ...string) (predefined string, includePaths, sysIncludePaths []string, err error)

HostCppConfig returns the system C preprocessor configuration, or an error, if any. The configuration is obtained by running the cpp command. For the predefined macros list the '-dM' options is added. For the include paths lists, the option '-v' is added and the output is parsed to extract the "..." include and <...> include paths. To add any other options to cpp, list them in opts.

The function relies on a POSIX compatible C preprocessor installed. Execution of HostConfig is not free, so caching the results is recommended whenever possible.

func ImportPath

func ImportPath() (string, error)

ImportPath returns the import path of this package or an error, if any.

func IsArithmeticType

func IsArithmeticType(t Type) bool

IsArithmeticType reports wheter t.Kind() is one of UintPtr, Char, SChar, UChar, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong, Float, Double, LongDouble, FloatComplex, DoubleComplex, LongDoubleComplex, Bool or Enum.

func IsIntType

func IsIntType(t Type) bool

IsIntType reports t.Kind() is one of Char, SChar, UChar, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong, Bool or Enum.

func PrettyString

func PrettyString(v interface{}) string

PrettyString pretty prints things produced by this package.

func TokSrc

func TokSrc(t xc.Token) string

TokSrc returns t in its source form.

Types

type AbstractDeclarator

type AbstractDeclarator struct {
	Case                     int
	DirectAbstractDeclarator *DirectAbstractDeclarator
	Pointer                  *Pointer
	PointerOpt               *PointerOpt
	// contains filtered or unexported fields
}

AbstractDeclarator represents data reduced by productions:

AbstractDeclarator:
        Pointer
|       PointerOpt DirectAbstractDeclarator  // Case 1
Example
fmt.Println(exampleAST(185, "\U00100001 ( _Bool * )"))
Output:

&cc.AbstractDeclarator{
· Pointer: &cc.Pointer{
· · Token: example185.c:1:10: '*',
· },
}
Example (Case1)
fmt.Println(exampleAST(186, "\U00100001 ( _Bool ( ) )"))
Output:

&cc.AbstractDeclarator{
· Case: 1,
· DirectAbstractDeclarator: &cc.DirectAbstractDeclarator{
· · Case: 6,
· · Token: example186.c:1:10: '(',
· · Token2: example186.c:1:12: ')',
· },
}

func (*AbstractDeclarator) Pos

func (n *AbstractDeclarator) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*AbstractDeclarator) String

func (n *AbstractDeclarator) String() string

String implements fmt.Stringer.

type AbstractDeclaratorOpt

type AbstractDeclaratorOpt struct {
	AbstractDeclarator *AbstractDeclarator
}

AbstractDeclaratorOpt represents data reduced by productions:

AbstractDeclaratorOpt:
        /* empty */
|       AbstractDeclarator  // Case 1
Example
fmt.Println(exampleAST(187, "\U00100001 ( _Bool )") == (*AbstractDeclaratorOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(188, "\U00100001 ( _Bool * )"))
Output:

&cc.AbstractDeclaratorOpt{
· AbstractDeclarator: &cc.AbstractDeclarator{
· · Pointer: &cc.Pointer{
· · · Token: example188.c:1:10: '*',
· · },
· },
}

func (*AbstractDeclaratorOpt) Pos

func (n *AbstractDeclaratorOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*AbstractDeclaratorOpt) String

func (n *AbstractDeclaratorOpt) String() string

String implements fmt.Stringer.

type ArgumentExpressionList

type ArgumentExpressionList struct {
	ArgumentExpressionList *ArgumentExpressionList
	Case                   int
	Expression             *Expression
	Token                  xc.Token
}

ArgumentExpressionList represents data reduced by productions:

ArgumentExpressionList:
        Expression
|       ArgumentExpressionList ',' Expression  // Case 1
Example
fmt.Println(exampleAST(8, "\U00100001 'a' ( 'b' )"))
Output:

&cc.ArgumentExpressionList{
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example8.c:1:8: CHARCONST "'b'",
· },
}
Example (Case1)
fmt.Println(exampleAST(9, "\U00100001 'a' ( 'b' , 'c' )"))
Output:

&cc.ArgumentExpressionList{
· ArgumentExpressionList: &cc.ArgumentExpressionList{
· · Case: 1,
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example9.c:1:14: CHARCONST "'c'",
· · },
· · Token: example9.c:1:12: ',',
· },
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example9.c:1:8: CHARCONST "'b'",
· },
}

func (*ArgumentExpressionList) Pos

func (n *ArgumentExpressionList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ArgumentExpressionList) String

func (n *ArgumentExpressionList) String() string

String implements fmt.Stringer.

type ArgumentExpressionListOpt

type ArgumentExpressionListOpt struct {
	ArgumentExpressionList *ArgumentExpressionList
}

ArgumentExpressionListOpt represents data reduced by productions:

ArgumentExpressionListOpt:
        /* empty */
|       ArgumentExpressionList  // Case 1
Example
fmt.Println(exampleAST(10, "\U00100001 'a' ( )") == (*ArgumentExpressionListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(11, "\U00100001 'a' ( 'b' )"))
Output:

&cc.ArgumentExpressionListOpt{
· ArgumentExpressionList: &cc.ArgumentExpressionList{
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example11.c:1:8: CHARCONST "'b'",
· · },
· },
}

func (*ArgumentExpressionListOpt) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ArgumentExpressionListOpt) String

func (n *ArgumentExpressionListOpt) String() string

String implements fmt.Stringer.

type AssemblerInstructions

type AssemblerInstructions struct {
	AssemblerInstructions *AssemblerInstructions
	Case                  int
	Token                 xc.Token
}

AssemblerInstructions represents data reduced by productions:

AssemblerInstructions:
        STRINGLITERAL
|       AssemblerInstructions STRINGLITERAL  // Case 1
Example
fmt.Println(exampleAST(265, "\U00100002 asm ( \"a\" )"))
Output:

&cc.AssemblerInstructions{
· Token: example265.c:1:8: STRINGLITERAL "\"a\"",
}
Example (Case1)
fmt.Println(exampleAST(266, "\U00100002 asm ( \"a\" \"b\" )"))
Output:

&cc.AssemblerInstructions{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Case: 1,
· · Token: example266.c:1:12: STRINGLITERAL "\"b\"",
· },
· Token: example266.c:1:8: STRINGLITERAL "\"a\"",
}

func (*AssemblerInstructions) Pos

func (n *AssemblerInstructions) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*AssemblerInstructions) String

func (n *AssemblerInstructions) String() string

String implements fmt.Stringer.

type AssemblerOperand

type AssemblerOperand struct {
	AssemblerSymbolicNameOpt *AssemblerSymbolicNameOpt
	Expression               *Expression
	Token                    xc.Token
	Token2                   xc.Token
	Token3                   xc.Token
}

AssemblerOperand represents data reduced by production:

AssemblerOperand:
        AssemblerSymbolicNameOpt STRINGLITERAL '(' Expression ')'
Example
fmt.Println(exampleAST(270, "\U00100002 a asm ( \"b\" : \"c\" ( 'd' ) )"))
Output:

&cc.AssemblerOperand{
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example270.c:1:22: CHARCONST "'d'",
· },
· Token: example270.c:1:16: STRINGLITERAL "\"c\"",
· Token2: example270.c:1:20: '(',
· Token3: example270.c:1:26: ')',
}

func (*AssemblerOperand) Pos

func (n *AssemblerOperand) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*AssemblerOperand) String

func (n *AssemblerOperand) String() string

String implements fmt.Stringer.

type AssemblerOperands

type AssemblerOperands struct {
	AssemblerOperand  *AssemblerOperand
	AssemblerOperands *AssemblerOperands
	Case              int
	Token             xc.Token
}

AssemblerOperands represents data reduced by productions:

AssemblerOperands:
        AssemblerOperand
|       AssemblerOperands ',' AssemblerOperand  // Case 1
Example
fmt.Println(exampleAST(271, "\U00100002 a asm ( \"b\" : \"c\" ( 'd' ) )"))
Output:

&cc.AssemblerOperands{
· AssemblerOperand: &cc.AssemblerOperand{
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example271.c:1:22: CHARCONST "'d'",
· · },
· · Token: example271.c:1:16: STRINGLITERAL "\"c\"",
· · Token2: example271.c:1:20: '(',
· · Token3: example271.c:1:26: ')',
· },
}
Example (Case1)
fmt.Println(exampleAST(272, "\U00100002 a asm ( \"b\" : \"c\" ( 'd' ) , \"e\" ( 'f' ) )"))
Output:

&cc.AssemblerOperands{
· AssemblerOperand: &cc.AssemblerOperand{
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example272.c:1:22: CHARCONST "'d'",
· · },
· · Token: example272.c:1:16: STRINGLITERAL "\"c\"",
· · Token2: example272.c:1:20: '(',
· · Token3: example272.c:1:26: ')',
· },
· AssemblerOperands: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example272.c:1:36: CHARCONST "'f'",
· · · },
· · · Token: example272.c:1:30: STRINGLITERAL "\"e\"",
· · · Token2: example272.c:1:34: '(',
· · · Token3: example272.c:1:40: ')',
· · },
· · Case: 1,
· · Token: example272.c:1:28: ',',
· },
}

func (*AssemblerOperands) Pos

func (n *AssemblerOperands) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*AssemblerOperands) String

func (n *AssemblerOperands) String() string

String implements fmt.Stringer.

type AssemblerStatement

type AssemblerStatement struct {
	AssemblerInstructions   *AssemblerInstructions
	AssemblerOperands       *AssemblerOperands
	AssemblerOperands2      *AssemblerOperands
	BasicAssemblerStatement *BasicAssemblerStatement
	Case                    int
	Clobbers                *Clobbers
	IdentifierList          *IdentifierList
	Token                   xc.Token
	Token2                  xc.Token
	Token3                  xc.Token
	Token4                  xc.Token
	Token5                  xc.Token
	Token6                  xc.Token
	Token7                  xc.Token
	Token8                  xc.Token
	VolatileOpt             *VolatileOpt
}

AssemblerStatement represents data reduced by productions:

AssemblerStatement:
        BasicAssemblerStatement
|       "asm" VolatileOpt '(' AssemblerInstructions ':' AssemblerOperands ')'                                             // Case 1
|       "asm" VolatileOpt '(' AssemblerInstructions ':' AssemblerOperands ':' AssemblerOperands ')'                       // Case 2
|       "asm" VolatileOpt '(' AssemblerInstructions ':' AssemblerOperands ':' AssemblerOperands ':' Clobbers ')'          // Case 3
|       "asm" VolatileOpt "goto" '(' AssemblerInstructions ':' ':' AssemblerOperands ':' Clobbers ':' IdentifierList ')'  // Case 4
|       "asm" VolatileOpt '(' AssemblerInstructions ':' ')'                                                               // Case 5
|       "asm" VolatileOpt '(' AssemblerInstructions ':' ':' AssemblerOperands ')'                                         // Case 6
Example
fmt.Println(exampleAST(277, "\U00100002 a asm ( \"b\" ) !"))
Output:

&cc.AssemblerStatement{
· BasicAssemblerStatement: &cc.BasicAssemblerStatement{
· · AssemblerInstructions: &cc.AssemblerInstructions{
· · · Token: example277.c:1:10: STRINGLITERAL "\"b\"",
· · },
· · Token: example277.c:1:4: ASM "asm",
· · Token2: example277.c:1:8: '(',
· · Token3: example277.c:1:14: ')',
· },
}
Example (Case1)
fmt.Println(exampleAST(278, "\U00100002 a asm ( \"b\" : \"c\" ( 'd' ) ) !"))
Output:

&cc.AssemblerStatement{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Token: example278.c:1:10: STRINGLITERAL "\"b\"",
· },
· AssemblerOperands: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example278.c:1:22: CHARCONST "'d'",
· · · },
· · · Token: example278.c:1:16: STRINGLITERAL "\"c\"",
· · · Token2: example278.c:1:20: '(',
· · · Token3: example278.c:1:26: ')',
· · },
· },
· Case: 1,
· Token: example278.c:1:4: ASM "asm",
· Token2: example278.c:1:8: '(',
· Token3: example278.c:1:14: ':',
· Token4: example278.c:1:28: ')',
}
Example (Case2)
fmt.Println(exampleAST(279, "\U00100002 a asm ( \"b\" : \"c\" ( 'd' ) : \"e\" ( 'f' ) ) !"))
Output:

&cc.AssemblerStatement{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Token: example279.c:1:10: STRINGLITERAL "\"b\"",
· },
· AssemblerOperands: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example279.c:1:22: CHARCONST "'d'",
· · · },
· · · Token: example279.c:1:16: STRINGLITERAL "\"c\"",
· · · Token2: example279.c:1:20: '(',
· · · Token3: example279.c:1:26: ')',
· · },
· },
· AssemblerOperands2: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example279.c:1:36: CHARCONST "'f'",
· · · },
· · · Token: example279.c:1:30: STRINGLITERAL "\"e\"",
· · · Token2: example279.c:1:34: '(',
· · · Token3: example279.c:1:40: ')',
· · },
· },
· Case: 2,
· Token: example279.c:1:4: ASM "asm",
· Token2: example279.c:1:8: '(',
· Token3: example279.c:1:14: ':',
· Token4: example279.c:1:28: ':',
· Token5: example279.c:1:42: ')',
}
Example (Case3)
fmt.Println(exampleAST(280, "\U00100002 a asm ( \"b\" : \"c\" ( 'd' ) : \"e\" ( 'f' ) : \"g\" ) !"))
Output:

&cc.AssemblerStatement{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Token: example280.c:1:10: STRINGLITERAL "\"b\"",
· },
· AssemblerOperands: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example280.c:1:22: CHARCONST "'d'",
· · · },
· · · Token: example280.c:1:16: STRINGLITERAL "\"c\"",
· · · Token2: example280.c:1:20: '(',
· · · Token3: example280.c:1:26: ')',
· · },
· },
· AssemblerOperands2: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example280.c:1:36: CHARCONST "'f'",
· · · },
· · · Token: example280.c:1:30: STRINGLITERAL "\"e\"",
· · · Token2: example280.c:1:34: '(',
· · · Token3: example280.c:1:40: ')',
· · },
· },
· Case: 3,
· Clobbers: &cc.Clobbers{
· · Token: example280.c:1:44: STRINGLITERAL "\"g\"",
· },
· Token: example280.c:1:4: ASM "asm",
· Token2: example280.c:1:8: '(',
· Token3: example280.c:1:14: ':',
· Token4: example280.c:1:28: ':',
· Token5: example280.c:1:42: ':',
· Token6: example280.c:1:48: ')',
}
Example (Case4)
fmt.Println(exampleAST(281, "\U00100002 a asm goto ( \"b\" : : \"c\" ( 'd' ) : \"e\" : f ) !"))
Output:

&cc.AssemblerStatement{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Token: example281.c:1:15: STRINGLITERAL "\"b\"",
· },
· AssemblerOperands: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example281.c:1:29: CHARCONST "'d'",
· · · },
· · · Token: example281.c:1:23: STRINGLITERAL "\"c\"",
· · · Token2: example281.c:1:27: '(',
· · · Token3: example281.c:1:33: ')',
· · },
· },
· Case: 4,
· Clobbers: &cc.Clobbers{
· · Token: example281.c:1:37: STRINGLITERAL "\"e\"",
· },
· IdentifierList: &cc.IdentifierList{
· · Token: example281.c:1:43: IDENTIFIER "f",
· },
· Token: example281.c:1:4: ASM "asm",
· Token2: example281.c:1:8: GOTO "goto",
· Token3: example281.c:1:13: '(',
· Token4: example281.c:1:19: ':',
· Token5: example281.c:1:21: ':',
· Token6: example281.c:1:35: ':',
· Token7: example281.c:1:41: ':',
· Token8: example281.c:1:45: ')',
}
Example (Case5)
fmt.Println(exampleAST(282, "\U00100002 a asm ( \"b\" : ) !"))
Output:

&cc.AssemblerStatement{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Token: example282.c:1:10: STRINGLITERAL "\"b\"",
· },
· Case: 5,
· Token: example282.c:1:4: ASM "asm",
· Token2: example282.c:1:8: '(',
· Token3: example282.c:1:14: ':',
· Token4: example282.c:1:16: ')',
}
Example (Case6)
fmt.Println(exampleAST(283, "\U00100002 a asm ( \"b\" : : \"c\" ( 'd' ) ) !"))
Output:

&cc.AssemblerStatement{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Token: example283.c:1:10: STRINGLITERAL "\"b\"",
· },
· AssemblerOperands: &cc.AssemblerOperands{
· · AssemblerOperand: &cc.AssemblerOperand{
· · · Expression: &cc.Expression{
· · · · Case: 1,
· · · · Token: example283.c:1:24: CHARCONST "'d'",
· · · },
· · · Token: example283.c:1:18: STRINGLITERAL "\"c\"",
· · · Token2: example283.c:1:22: '(',
· · · Token3: example283.c:1:28: ')',
· · },
· },
· Case: 6,
· Token: example283.c:1:4: ASM "asm",
· Token2: example283.c:1:8: '(',
· Token3: example283.c:1:14: ':',
· Token4: example283.c:1:16: ':',
· Token5: example283.c:1:30: ')',
}

func (*AssemblerStatement) Pos

func (n *AssemblerStatement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*AssemblerStatement) String

func (n *AssemblerStatement) String() string

String implements fmt.Stringer.

type AssemblerSymbolicNameOpt

type AssemblerSymbolicNameOpt struct {
	Token  xc.Token
	Token2 xc.Token
	Token3 xc.Token
}

AssemblerSymbolicNameOpt represents data reduced by productions:

AssemblerSymbolicNameOpt:
        /* empty */
|       '[' IDENTIFIER ']'  // Case 1
Example
fmt.Println(exampleAST(273, "\U00100002 a asm goto ( \"b\" : : \"c\"") == (*AssemblerSymbolicNameOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(274, "\U00100002 a asm ( \"b\" : [ c ] \"d\""))
Output:

&cc.AssemblerSymbolicNameOpt{
· Token: example274.c:1:16: '[',
· Token2: example274.c:1:18: IDENTIFIER "c",
· Token3: example274.c:1:20: ']',
}

func (*AssemblerSymbolicNameOpt) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*AssemblerSymbolicNameOpt) String

func (n *AssemblerSymbolicNameOpt) String() string

String implements fmt.Stringer.

type BasicAssemblerStatement

type BasicAssemblerStatement struct {
	AssemblerInstructions *AssemblerInstructions
	Token                 xc.Token
	Token2                xc.Token
	Token3                xc.Token
	VolatileOpt           *VolatileOpt
}

BasicAssemblerStatement represents data reduced by production:

BasicAssemblerStatement:
        "asm" VolatileOpt '(' AssemblerInstructions ')'
Example
fmt.Println(exampleAST(267, "\U00100002 asm ( \"a\" ) !"))
Output:

&cc.BasicAssemblerStatement{
· AssemblerInstructions: &cc.AssemblerInstructions{
· · Token: example267.c:1:8: STRINGLITERAL "\"a\"",
· },
· Token: example267.c:1:2: ASM "asm",
· Token2: example267.c:1:6: '(',
· Token3: example267.c:1:12: ')',
}

func (*BasicAssemblerStatement) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*BasicAssemblerStatement) String

func (n *BasicAssemblerStatement) String() string

String implements fmt.Stringer.

type Binding

type Binding struct {
	Node Node
	// contains filtered or unexported fields
}

Binding records the declaration Node of a declared name.

In the NSIdentifiers namespace the dynamic type of Node for declared names is always *DirectDeclarator. The *Declarator associated with the direct declarator is available via (*DirectDeclarator).TopDeclarator().

int* p;

In the NSTags namespace the dynamic type of Node is xc.Token when a tag is declared:

struct foo;
enum bar;

When a tag is defined, the dynamic type of Node is *EnumSpecifier or *StructOrUnionSpecifier:

struct foo { int i; };
enum bar { a = 1 };

type Bindings

type Bindings struct {
	Identifiers map[int]Binding // NSIdentifiers name space bindings.
	Tags        map[int]Binding // NSTags name space bindings.

	Parent *Bindings // Parent scope or nil for ScopeFile.
	// contains filtered or unexported fields
}

Bindings record names declared in a scope.

func (*Bindings) Lookup

func (b *Bindings) Lookup(ns Namespace, id int) Binding

Lookup returns the Binding of id in ns or any of its parents. If id is undeclared, the returned Binding has its Node field set to nil.

func (*Bindings) Lookup2

func (b *Bindings) Lookup2(ns Namespace, id int) (Binding, *Bindings)

Lookup2 is like Lookup but addionally it returns also the scope in which id was found.

func (*Bindings) Scope

func (b *Bindings) Scope() Scope

Scope retuns the kind of b.

type BlockItem

type BlockItem struct {
	Case        int
	Declaration *Declaration
	Statement   *Statement
}

BlockItem represents data reduced by productions:

BlockItem:
        Declaration
|       Statement    // Case 1
Example
fmt.Println(exampleAST(230, "\U00100001 ( { auto ; !"))
Output:

&cc.BlockItem{
· Declaration: &cc.Declaration{
· · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · Case: 3,
· · · · Token: example230.c:1:6: AUTO "auto",
· · · },
· · },
· · Token: example230.c:1:11: ';',
· },
}
Example (Case1)
fmt.Println(exampleAST(231, "\U00100001 ( { ; !"))
Output:

&cc.BlockItem{
· Case: 1,
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example231.c:1:6: ';',
· · },
· },
}

func (*BlockItem) Pos

func (n *BlockItem) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*BlockItem) String

func (n *BlockItem) String() string

String implements fmt.Stringer.

type BlockItemList

type BlockItemList struct {
	BlockItem     *BlockItem
	BlockItemList *BlockItemList
	Case          int
}

BlockItemList represents data reduced by productions:

BlockItemList:
        BlockItem
|       BlockItemList BlockItem  // Case 1
Example
fmt.Println(exampleAST(226, "\U00100001 ( { ; !"))
Output:

&cc.BlockItemList{
· BlockItem: &cc.BlockItem{
· · Case: 1,
· · Statement: &cc.Statement{
· · · Case: 2,
· · · ExpressionStatement: &cc.ExpressionStatement{
· · · · Token: example226.c:1:6: ';',
· · · },
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(227, "\U00100001 ( { ; ; !"))
Output:

&cc.BlockItemList{
· BlockItem: &cc.BlockItem{
· · Case: 1,
· · Statement: &cc.Statement{
· · · Case: 2,
· · · ExpressionStatement: &cc.ExpressionStatement{
· · · · Token: example227.c:1:6: ';',
· · · },
· · },
· },
· BlockItemList: &cc.BlockItemList{
· · BlockItem: &cc.BlockItem{
· · · Case: 1,
· · · Statement: &cc.Statement{
· · · · Case: 2,
· · · · ExpressionStatement: &cc.ExpressionStatement{
· · · · · Token: example227.c:1:8: ';',
· · · · },
· · · },
· · },
· · Case: 1,
· },
}

func (*BlockItemList) Pos

func (n *BlockItemList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*BlockItemList) String

func (n *BlockItemList) String() string

String implements fmt.Stringer.

type BlockItemListOpt

type BlockItemListOpt struct {
	BlockItemList *BlockItemList
}

BlockItemListOpt represents data reduced by productions:

BlockItemListOpt:
        /* empty */
|       BlockItemList  // Case 1
Example
fmt.Println(exampleAST(228, "\U00100001 ( { }") == (*BlockItemListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(229, "\U00100001 ( { ; }"))
Output:

&cc.BlockItemListOpt{
· BlockItemList: &cc.BlockItemList{
· · BlockItem: &cc.BlockItem{
· · · Case: 1,
· · · Statement: &cc.Statement{
· · · · Case: 2,
· · · · ExpressionStatement: &cc.ExpressionStatement{
· · · · · Token: example229.c:1:6: ';',
· · · · },
· · · },
· · },
· },
}

func (*BlockItemListOpt) Pos

func (n *BlockItemListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*BlockItemListOpt) String

func (n *BlockItemListOpt) String() string

String implements fmt.Stringer.

type Clobbers

type Clobbers struct {
	Case     int
	Clobbers *Clobbers
	Token    xc.Token
	Token2   xc.Token
}

Clobbers represents data reduced by productions:

Clobbers:
        STRINGLITERAL
|       Clobbers ',' STRINGLITERAL  // Case 1
Example
fmt.Println(exampleAST(275, "\U00100002 a asm goto ( \"b\" : : \"c\" ( 'd' ) : \"e\" )"))
Output:

&cc.Clobbers{
· Token: example275.c:1:37: STRINGLITERAL "\"e\"",
}
Example (Case1)
fmt.Println(exampleAST(276, "\U00100002 a asm goto ( \"b\" : : \"c\" ( 'd' ) : \"e\" , \"f\" )"))
Output:

&cc.Clobbers{
· Clobbers: &cc.Clobbers{
· · Case: 1,
· · Token: example276.c:1:41: ',',
· · Token2: example276.c:1:43: STRINGLITERAL "\"f\"",
· },
· Token: example276.c:1:37: STRINGLITERAL "\"e\"",
}

func (*Clobbers) Pos

func (n *Clobbers) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Clobbers) String

func (n *Clobbers) String() string

String implements fmt.Stringer.

type CommaOpt

type CommaOpt struct {
	Token xc.Token
}

CommaOpt represents data reduced by productions:

CommaOpt:
        /* empty */
|       ','          // Case 1
Example
fmt.Println(exampleAST(135, "\U00100002 auto a = { }") == (*CommaOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(136, "\U00100002 auto a = { , }"))
Output:

&cc.CommaOpt{
· Token: example136.c:1:13: ',',
}

func (*CommaOpt) Pos

func (n *CommaOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*CommaOpt) String

func (n *CommaOpt) String() string

String implements fmt.Stringer.

type CompoundStatement

type CompoundStatement struct {
	BlockItemListOpt *BlockItemListOpt
	Token            xc.Token
	Token2           xc.Token
	// contains filtered or unexported fields
}

CompoundStatement represents data reduced by production:

CompoundStatement:
        '{' BlockItemListOpt '}'
Example
fmt.Println(exampleAST(225, "\U00100001 ( { }"))
Output:

&cc.CompoundStatement{
· Token: example225.c:1:4: '{',
· Token2: example225.c:1:6: '}',
}

func (*CompoundStatement) Pos

func (n *CompoundStatement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*CompoundStatement) Scope

func (n *CompoundStatement) Scope() *Bindings

Scope returns n's scope.

func (*CompoundStatement) String

func (n *CompoundStatement) String() string

String implements fmt.Stringer.

type ComputedGotoID

type ComputedGotoID int

StringLitID is the type of an Expression.Value representing the numeric ID of a label name used in &&label.

type ConstantExpression

type ConstantExpression struct {
	Type  Type        // Type of expression.
	Value interface{} // Non nil for certain constant expressions.

	Expression *Expression
	// contains filtered or unexported fields
}

ConstantExpression represents data reduced by production:

ConstantExpression:
        Expression
Example
fmt.Println(exampleAST(79, "\U00100001 'a'"))
Output:

&cc.ConstantExpression{
· Type: int,
· Value: 97,
· Expression: &cc.Expression{
· · Type: int,
· · Value: 97,
· · Case: 1,
· · Token: example79.c:1:2: CHARCONST "'a'",
· },
}

func (*ConstantExpression) Pos

func (n *ConstantExpression) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ConstantExpression) String

func (n *ConstantExpression) String() string

String implements fmt.Stringer.

type ControlLine

type ControlLine struct {
	Case              int
	IdentifierList    *IdentifierList
	IdentifierListOpt *IdentifierListOpt
	PPTokenList       PPTokenList
	PPTokenListOpt    PPTokenList
	ReplacementList   PPTokenList
	Token             xc.Token
	Token2            xc.Token
	Token3            xc.Token
	Token4            xc.Token
	Token5            xc.Token
}

ControlLine represents data reduced by productions:

ControlLine:
        PPDEFINE IDENTIFIER ReplacementList
|       PPDEFINE IDENTIFIER_LPAREN "..." ')' ReplacementList                     // Case 1
|       PPDEFINE IDENTIFIER_LPAREN IdentifierList ',' "..." ')' ReplacementList  // Case 2
|       PPDEFINE IDENTIFIER_LPAREN IdentifierListOpt ')' ReplacementList         // Case 3
|       PPERROR PPTokenListOpt                                                   // Case 4
|       PPHASH_NL                                                                // Case 5
|       PPINCLUDE PPTokenList '\n'                                               // Case 6
|       PPLINE PPTokenList '\n'                                                  // Case 7
|       PPPRAGMA PPTokenListOpt                                                  // Case 8
|       PPUNDEF IDENTIFIER '\n'                                                  // Case 9
|       PPDEFINE IDENTIFIER_LPAREN IdentifierList "..." ')' ReplacementList      // Case 10
|       PPDEFINE '\n'                                                            // Case 11
|       PPUNDEF IDENTIFIER PPTokenList '\n'                                      // Case 12
|       PPINCLUDE_NEXT PPTokenList '\n'                                          // Case 13
Example
fmt.Println(exampleAST(307, "\U00100000 \n#define a "))
Output:

&cc.ControlLine{
· ReplacementList: []xc.Token{ // len 1
· · 0: example307.c:2:10: ' ',
· },
· Token: example307.c:2:2: PPDEFINE,
· Token2: example307.c:2:9: IDENTIFIER "a",
}
Example (Case01)
fmt.Println(exampleAST(308, "\U00100000 \n#define a( ... ) "))
Output:

&cc.ControlLine{
· Case: 1,
· ReplacementList: []xc.Token{ // len 1
· · 0: example308.c:2:17: ' ',
· },
· Token: example308.c:2:2: PPDEFINE,
· Token2: example308.c:2:9: IDENTIFIER_LPAREN "a(",
· Token3: example308.c:2:12: DDD,
· Token4: example308.c:2:16: ')',
}
Example (Case02)
fmt.Println(exampleAST(309, "\U00100000 \n#define a( b , ... ) "))
Output:

&cc.ControlLine{
· Case: 2,
· IdentifierList: &cc.IdentifierList{
· · Token: example309.c:2:12: IDENTIFIER "b",
· },
· ReplacementList: []xc.Token{ // len 1
· · 0: example309.c:2:21: ' ',
· },
· Token: example309.c:2:2: PPDEFINE,
· Token2: example309.c:2:9: IDENTIFIER_LPAREN "a(",
· Token3: example309.c:2:14: ',',
· Token4: example309.c:2:16: DDD,
· Token5: example309.c:2:20: ')',
}
Example (Case03)
fmt.Println(exampleAST(310, "\U00100000 \n#define a( ) "))
Output:

&cc.ControlLine{
· Case: 3,
· ReplacementList: []xc.Token{ // len 1
· · 0: example310.c:2:13: ' ',
· },
· Token: example310.c:2:2: PPDEFINE,
· Token2: example310.c:2:9: IDENTIFIER_LPAREN "a(",
· Token3: example310.c:2:12: ')',
}
Example (Case04)
fmt.Println(exampleAST(311, "\U00100000 \n#error "))
Output:

&cc.ControlLine{
· Case: 4,
· PPTokenListOpt: []xc.Token{ // len 1
· · 0: example311.c:2:7: ' ',
· },
· Token: example311.c:2:2: PPERROR,
}
Example (Case05)
fmt.Println(exampleAST(312, "\U00100000 \n#"))
Output:

&cc.ControlLine{
· Case: 5,
· Token: example312.c:2:2: PPHASH_NL,
}
Example (Case06)
fmt.Println(exampleAST(313, "\U00100000 \n#include other_a "))
Output:

&cc.ControlLine{
· Case: 6,
· PPTokenList: []xc.Token{ // len 3
· · 0: example313.c:2:9: ' ',
· · 1: example313.c:2:10: IDENTIFIER "other_a",
· · 2: example313.c:2:17: ' ',
· },
· Token: example313.c:2:2: PPINCLUDE,
· Token2: example313.c:2:18: '\n',
}
Example (Case07)
fmt.Println(exampleAST(314, "\U00100000 \n#line other_a "))
Output:

&cc.ControlLine{
· Case: 7,
· PPTokenList: []xc.Token{ // len 3
· · 0: example314.c:2:6: ' ',
· · 1: example314.c:2:7: IDENTIFIER "other_a",
· · 2: example314.c:2:14: ' ',
· },
· Token: example314.c:2:2: PPLINE,
· Token2: example314.c:2:15: '\n',
}
Example (Case08)
fmt.Println(exampleAST(315, "\U00100000 \n#pragma "))
Output:

&cc.ControlLine{
· Case: 8,
· PPTokenListOpt: []xc.Token{ // len 1
· · 0: example315.c:2:8: ' ',
· },
· Token: example315.c:2:2: PPPRAGMA,
}
Example (Case09)
fmt.Println(exampleAST(316, "\U00100000 \n#undef foo"))
Output:

&cc.ControlLine{
· Case: 9,
· Token: example316.c:2:2: PPUNDEF,
· Token2: example316.c:2:8: IDENTIFIER "foo",
· Token3: example316.c:2:11: '\n',
}
Example (Case10)
fmt.Println(exampleAST(317, "\U00100000 \n#define a( b ... ) "))
Output:

&cc.ControlLine{
· Case: 10,
· IdentifierList: &cc.IdentifierList{
· · Token: example317.c:2:12: IDENTIFIER "b",
· },
· ReplacementList: []xc.Token{ // len 1
· · 0: example317.c:2:19: ' ',
· },
· Token: example317.c:2:2: PPDEFINE,
· Token2: example317.c:2:9: IDENTIFIER_LPAREN "a(",
· Token3: example317.c:2:14: DDD,
· Token4: example317.c:2:18: ')',
}
Example (Case11)
fmt.Println(exampleAST(318, "\U00100000 \n#define "))
Output:

&cc.ControlLine{
· Case: 11,
· Token: example318.c:2:2: PPDEFINE,
· Token2: example318.c:2:9: '\n',
}
Example (Case12)
fmt.Println(exampleAST(319, "\U00100000 \n#undef foo(bar)"))
Output:

&cc.ControlLine{
· Case: 12,
· PPTokenList: []xc.Token{ // len 3
· · 0: example319.c:2:11: '(',
· · 1: example319.c:2:12: IDENTIFIER "bar",
· · 2: example319.c:2:15: ')',
· },
· Token: example319.c:2:2: PPUNDEF,
· Token2: example319.c:2:8: IDENTIFIER "foo",
· Token3: example319.c:2:16: '\n',
}
Example (Case13)
fmt.Println(exampleAST(320, "\U00100000 \n#include_next other_a "))
Output:

&cc.ControlLine{
· Case: 13,
· PPTokenList: []xc.Token{ // len 3
· · 0: example320.c:2:14: ' ',
· · 1: example320.c:2:15: IDENTIFIER "other_a",
· · 2: example320.c:2:22: ' ',
· },
· Token: example320.c:2:2: PPINCLUDE_NEXT,
· Token2: example320.c:2:23: '\n',
}

func (*ControlLine) Pos

func (n *ControlLine) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ControlLine) String

func (n *ControlLine) String() string

String implements fmt.Stringer.

type Declaration

type Declaration struct {
	Case                    int
	DeclarationSpecifiers   *DeclarationSpecifiers
	InitDeclaratorListOpt   *InitDeclaratorListOpt
	StaticAssertDeclaration *StaticAssertDeclaration
	Token                   xc.Token
	// contains filtered or unexported fields
}

Declaration represents data reduced by productions:

Declaration:
        DeclarationSpecifiers InitDeclaratorListOpt ';'
|       StaticAssertDeclaration                          // Case 1
Example
fmt.Println(exampleAST(80, "\U00100002 auto ;"))
Output:

&cc.Declaration{
· DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · Case: 3,
· · · Token: example80.c:1:2: AUTO "auto",
· · },
· },
· Token: example80.c:1:7: ';',
}
Example (Case1)
fmt.Println(exampleAST(81, "\U00100002 _Static_assert ( 'a' , \"b\" ) ;"))
Output:

&cc.Declaration{
· Case: 1,
· StaticAssertDeclaration: &cc.StaticAssertDeclaration{
· · ConstantExpression: &cc.ConstantExpression{
· · · Type: int,
· · · Value: 97,
· · · Expression: &cc.Expression{
· · · · Type: int,
· · · · Value: 97,
· · · · Case: 1,
· · · · Token: example81.c:1:19: CHARCONST "'a'",
· · · },
· · },
· · Token: example81.c:1:2: STATIC_ASSERT "_Static_assert",
· · Token2: example81.c:1:17: '(',
· · Token3: example81.c:1:23: ',',
· · Token4: example81.c:1:25: STRINGLITERAL "\"b\"",
· · Token5: example81.c:1:29: ')',
· · Token6: example81.c:1:31: ';',
· },
}

func (*Declaration) Declarator

func (n *Declaration) Declarator() *Declarator

Declarator returns a synthetic Declarator when n.InitDeclaratorListOpt is nil.

func (*Declaration) Pos

func (n *Declaration) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Declaration) String

func (n *Declaration) String() string

String implements fmt.Stringer.

type DeclarationList

type DeclarationList struct {
	Case            int
	Declaration     *Declaration
	DeclarationList *DeclarationList
}

DeclarationList represents data reduced by productions:

DeclarationList:
        Declaration
|       DeclarationList Declaration  // Case 1
Example
fmt.Println(exampleAST(260, "\U00100002 a auto ; {"))
Output:

&cc.DeclarationList{
· Declaration: &cc.Declaration{
· · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · Case: 3,
· · · · Token: example260.c:1:4: AUTO "auto",
· · · },
· · },
· · Token: example260.c:1:9: ';',
· },
}
Example (Case1)
fmt.Println(exampleAST(261, "\U00100002 a auto ; auto ; {"))
Output:

&cc.DeclarationList{
· Declaration: &cc.Declaration{
· · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · Case: 3,
· · · · Token: example261.c:1:4: AUTO "auto",
· · · },
· · },
· · Token: example261.c:1:9: ';',
· },
· DeclarationList: &cc.DeclarationList{
· · Case: 1,
· · Declaration: &cc.Declaration{
· · · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · · Case: 3,
· · · · · Token: example261.c:1:11: AUTO "auto",
· · · · },
· · · },
· · · Token: example261.c:1:16: ';',
· · },
· },
}

func (*DeclarationList) Pos

func (n *DeclarationList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DeclarationList) String

func (n *DeclarationList) String() string

String implements fmt.Stringer.

type DeclarationListOpt

type DeclarationListOpt struct {
	DeclarationList *DeclarationList
	// contains filtered or unexported fields
}

DeclarationListOpt represents data reduced by productions:

DeclarationListOpt:
        /* empty */
|       DeclarationList  // Case 1
Example
fmt.Println(exampleAST(262, "\U00100002 a {") == (*DeclarationListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(264, "\U00100002 a auto ; {"))
Output:

&cc.DeclarationListOpt{
· DeclarationList: &cc.DeclarationList{
· · Declaration: &cc.Declaration{
· · · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · · Case: 3,
· · · · · Token: example264.c:1:4: AUTO "auto",
· · · · },
· · · },
· · · Token: example264.c:1:9: ';',
· · },
· },
}

func (*DeclarationListOpt) Pos

func (n *DeclarationListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DeclarationListOpt) String

func (n *DeclarationListOpt) String() string

String implements fmt.Stringer.

type DeclarationSpecifiers

type DeclarationSpecifiers struct {
	Case                     int
	DeclarationSpecifiersOpt *DeclarationSpecifiersOpt
	FunctionSpecifier        *FunctionSpecifier
	StorageClassSpecifier    *StorageClassSpecifier
	TypeQualifier            *TypeQualifier
	TypeSpecifier            *TypeSpecifier
	// contains filtered or unexported fields
}

DeclarationSpecifiers represents data reduced by productions:

DeclarationSpecifiers:
        StorageClassSpecifier DeclarationSpecifiersOpt
|       TypeSpecifier DeclarationSpecifiersOpt          // Case 1
|       TypeQualifier DeclarationSpecifiersOpt          // Case 2
|       FunctionSpecifier DeclarationSpecifiersOpt      // Case 3
Example
fmt.Println(exampleAST(82, "\U00100002 auto ("))
Output:

&cc.DeclarationSpecifiers{
· StorageClassSpecifier: &cc.StorageClassSpecifier{
· · Case: 3,
· · Token: example82.c:1:2: AUTO "auto",
· },
}
Example (Case1)
fmt.Println(exampleAST(83, "\U00100002 _Bool ("))
Output:

&cc.DeclarationSpecifiers{
· Case: 1,
· TypeSpecifier: &cc.TypeSpecifier{
· · Case: 9,
· · Token: example83.c:1:2: BOOL "_Bool",
· },
}
Example (Case2)
fmt.Println(exampleAST(84, "\U00100002 const ("))
Output:

&cc.DeclarationSpecifiers{
· Case: 2,
· TypeQualifier: &cc.TypeQualifier{
· · Token: example84.c:1:2: CONST "const",
· },
}
Example (Case3)
fmt.Println(exampleAST(85, "\U00100002 inline ("))
Output:

&cc.DeclarationSpecifiers{
· Case: 3,
· FunctionSpecifier: &cc.FunctionSpecifier{
· · Token: example85.c:1:2: INLINE "inline",
· },
}

func (*DeclarationSpecifiers) IsAuto

func (n *DeclarationSpecifiers) IsAuto() bool

IsAuto implements specifier.

func (*DeclarationSpecifiers) IsConst

func (n *DeclarationSpecifiers) IsConst() bool

IsConst returns whether n includes the 'const' type qualifier.

func (*DeclarationSpecifiers) IsExtern

func (n *DeclarationSpecifiers) IsExtern() bool

IsExtern implements specifier.

func (*DeclarationSpecifiers) IsInline

func (n *DeclarationSpecifiers) IsInline() bool

IsInline implements specifier.

func (*DeclarationSpecifiers) IsRegister

func (n *DeclarationSpecifiers) IsRegister() bool

IsRegister implements specifier.

func (*DeclarationSpecifiers) IsRestrict

func (n *DeclarationSpecifiers) IsRestrict() bool

IsRestrict implements specifier.

func (*DeclarationSpecifiers) IsStatic

func (n *DeclarationSpecifiers) IsStatic() bool

IsStatic implements specifier.

func (*DeclarationSpecifiers) IsTypedef

func (n *DeclarationSpecifiers) IsTypedef() bool

IsTypedef implements specifier.

func (*DeclarationSpecifiers) IsVolatile

func (n *DeclarationSpecifiers) IsVolatile() bool

IsVolatile implements specifier.

func (*DeclarationSpecifiers) Pos

func (n *DeclarationSpecifiers) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DeclarationSpecifiers) String

func (n *DeclarationSpecifiers) String() string

String implements fmt.Stringer.

func (*DeclarationSpecifiers) TypedefName

func (n *DeclarationSpecifiers) TypedefName() int

TypedefName implements Specifier.

type DeclarationSpecifiersOpt

type DeclarationSpecifiersOpt struct {
	DeclarationSpecifiers *DeclarationSpecifiers
	// contains filtered or unexported fields
}

DeclarationSpecifiersOpt represents data reduced by productions:

DeclarationSpecifiersOpt:
        /* empty */
|       DeclarationSpecifiers  // Case 1
Example
fmt.Println(exampleAST(86, "\U00100002 auto (") == (*DeclarationSpecifiersOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(87, "\U00100002 auto auto ("))
Output:

&cc.DeclarationSpecifiersOpt{
· DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · Case: 3,
· · · Token: example87.c:1:7: AUTO "auto",
· · },
· },
}

func (*DeclarationSpecifiersOpt) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DeclarationSpecifiersOpt) String

func (n *DeclarationSpecifiersOpt) String() string

String implements fmt.Stringer.

type Declarator

type Declarator struct {
	Linkage Linkage
	Type    Type

	DirectDeclarator *DirectDeclarator
	PointerOpt       *PointerOpt
	// contains filtered or unexported fields
}

Declarator represents data reduced by production:

Declarator:
        PointerOpt DirectDeclarator
Example
fmt.Println(exampleAST(149, "\U00100002 a )"))
Output:

&cc.Declarator{
· Linkage: None,
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: example149.c:1:2: IDENTIFIER "a",
· },
}

func (*Declarator) Identifier

func (n *Declarator) Identifier() (int, *Bindings)

Identifier returns the ID of the name declared by n and the scope the name is declared in.

func (*Declarator) Pos

func (n *Declarator) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Declarator) RawSpecifier

func (n *Declarator) RawSpecifier() Specifier

RawSpecifier returns the raw Specifier associated with n before expanding typedefs. The effective Specifier is accessible via the Type field of n.

func (*Declarator) String

func (n *Declarator) String() string

String implements fmt.Stringer.

type DeclaratorOpt

type DeclaratorOpt struct {
	Declarator *Declarator
}

DeclaratorOpt represents data reduced by productions:

DeclaratorOpt:
        /* empty */
|       Declarator   // Case 1
Example
fmt.Println(exampleAST(150, "\U00100002 struct { _Bool :") == (*DeclaratorOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(151, "\U00100002 struct { _Bool a :"))
Output:

&cc.DeclaratorOpt{
· Declarator: &cc.Declarator{
· · Linkage: None,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example151.c:1:17: IDENTIFIER "a",
· · },
· },
}

func (*DeclaratorOpt) Pos

func (n *DeclaratorOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DeclaratorOpt) String

func (n *DeclaratorOpt) String() string

String implements fmt.Stringer.

type Designation

type Designation struct {
	DesignatorList *DesignatorList
	Token          xc.Token
}

Designation represents data reduced by production:

Designation:
        DesignatorList '='
Example
fmt.Println(exampleAST(207, "\U00100002 auto a = { . b = !"))
Output:

&cc.Designation{
· DesignatorList: &cc.DesignatorList{
· · Designator: &cc.Designator{
· · · Case: 1,
· · · Token: example207.c:1:13: '.',
· · · Token2: example207.c:1:15: IDENTIFIER "b",
· · },
· },
· Token: example207.c:1:17: '=',
}

func (*Designation) Pos

func (n *Designation) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Designation) String

func (n *Designation) String() string

String implements fmt.Stringer.

type DesignationOpt

type DesignationOpt struct {
	Designation *Designation
}

DesignationOpt represents data reduced by productions:

DesignationOpt:
        /* empty */
|       Designation  // Case 1
Example
fmt.Println(exampleAST(208, "\U00100002 auto a = { !") == (*DesignationOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(209, "\U00100002 auto a = { . b = !"))
Output:

&cc.DesignationOpt{
· Designation: &cc.Designation{
· · DesignatorList: &cc.DesignatorList{
· · · Designator: &cc.Designator{
· · · · Case: 1,
· · · · Token: example209.c:1:13: '.',
· · · · Token2: example209.c:1:15: IDENTIFIER "b",
· · · },
· · },
· · Token: example209.c:1:17: '=',
· },
}

func (*DesignationOpt) Pos

func (n *DesignationOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DesignationOpt) String

func (n *DesignationOpt) String() string

String implements fmt.Stringer.

type Designator

type Designator struct {
	Case               int
	ConstantExpression *ConstantExpression
	Token              xc.Token
	Token2             xc.Token
}

Designator represents data reduced by productions:

Designator:
        '[' ConstantExpression ']'
|       '.' IDENTIFIER              // Case 1
Example
fmt.Println(exampleAST(212, "\U00100002 auto a = { [ 'b' ] ."))
Output:

&cc.Designator{
· ConstantExpression: &cc.ConstantExpression{
· · Type: int,
· · Value: 98,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 98,
· · · Case: 1,
· · · Token: example212.c:1:15: CHARCONST "'b'",
· · },
· },
· Token: example212.c:1:13: '[',
· Token2: example212.c:1:19: ']',
}
Example (Case1)
fmt.Println(exampleAST(213, "\U00100002 auto a = { . b ."))
Output:

&cc.Designator{
· Case: 1,
· Token: example213.c:1:13: '.',
· Token2: example213.c:1:15: IDENTIFIER "b",
}

func (*Designator) Pos

func (n *Designator) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Designator) String

func (n *Designator) String() string

String implements fmt.Stringer.

type DesignatorList

type DesignatorList struct {
	Case           int
	Designator     *Designator
	DesignatorList *DesignatorList
}

DesignatorList represents data reduced by productions:

DesignatorList:
        Designator
|       DesignatorList Designator  // Case 1
Example
fmt.Println(exampleAST(210, "\U00100002 auto a = { . b ."))
Output:

&cc.DesignatorList{
· Designator: &cc.Designator{
· · Case: 1,
· · Token: example210.c:1:13: '.',
· · Token2: example210.c:1:15: IDENTIFIER "b",
· },
}
Example (Case1)
fmt.Println(exampleAST(211, "\U00100002 auto a = { . b . c ."))
Output:

&cc.DesignatorList{
· Designator: &cc.Designator{
· · Case: 1,
· · Token: example211.c:1:13: '.',
· · Token2: example211.c:1:15: IDENTIFIER "b",
· },
· DesignatorList: &cc.DesignatorList{
· · Case: 1,
· · Designator: &cc.Designator{
· · · Case: 1,
· · · Token: example211.c:1:17: '.',
· · · Token2: example211.c:1:19: IDENTIFIER "c",
· · },
· },
}

func (*DesignatorList) Pos

func (n *DesignatorList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DesignatorList) String

func (n *DesignatorList) String() string

String implements fmt.Stringer.

type DirectAbstractDeclarator

type DirectAbstractDeclarator struct {
	AbstractDeclarator          *AbstractDeclarator
	Case                        int
	DirectAbstractDeclarator    *DirectAbstractDeclarator
	DirectAbstractDeclaratorOpt *DirectAbstractDeclaratorOpt
	Expression                  *Expression
	ExpressionOpt               *ExpressionOpt
	ParameterTypeListOpt        *ParameterTypeListOpt
	Token                       xc.Token
	Token2                      xc.Token
	Token3                      xc.Token
	TypeQualifierList           *TypeQualifierList
	TypeQualifierListOpt        *TypeQualifierListOpt
	// contains filtered or unexported fields
}

DirectAbstractDeclarator represents data reduced by productions:

DirectAbstractDeclarator:
        '(' AbstractDeclarator ')'
|       DirectAbstractDeclaratorOpt '[' ExpressionOpt ']'                             // Case 1
|       DirectAbstractDeclaratorOpt '[' TypeQualifierList ExpressionOpt ']'           // Case 2
|       DirectAbstractDeclaratorOpt '[' "static" TypeQualifierListOpt Expression ']'  // Case 3
|       DirectAbstractDeclaratorOpt '[' TypeQualifierList "static" Expression ']'     // Case 4
|       DirectAbstractDeclaratorOpt '[' '*' ']'                                       // Case 5
|       '(' ParameterTypeListOpt ')'                                                  // Case 6
|       DirectAbstractDeclarator '(' ParameterTypeListOpt ')'                         // Case 7
Example
fmt.Println(exampleAST(189, "\U00100001 ( _Bool ( * ) ("))
Output:

&cc.DirectAbstractDeclarator{
· AbstractDeclarator: &cc.AbstractDeclarator{
· · Pointer: &cc.Pointer{
· · · Token: example189.c:1:12: '*',
· · },
· },
· Token: example189.c:1:10: '(',
· Token2: example189.c:1:14: ')',
}
Example (Case1)
fmt.Println(exampleAST(190, "\U00100001 ( _Bool [ ] ("))
Output:

&cc.DirectAbstractDeclarator{
· Case: 1,
· Token: example190.c:1:10: '[',
· Token2: example190.c:1:12: ']',
}
Example (Case2)
fmt.Println(exampleAST(191, "\U00100001 ( _Bool [ const ] ("))
Output:

&cc.DirectAbstractDeclarator{
· Case: 2,
· Token: example191.c:1:10: '[',
· Token2: example191.c:1:18: ']',
· TypeQualifierList: &cc.TypeQualifierList{
· · TypeQualifier: &cc.TypeQualifier{
· · · Token: example191.c:1:12: CONST "const",
· · },
· },
}
Example (Case3)
fmt.Println(exampleAST(192, "\U00100001 ( _Bool [ static 'a' ] ("))
Output:

&cc.DirectAbstractDeclarator{
· Case: 3,
· Expression: &cc.Expression{
· · Type: int,
· · Value: 97,
· · Case: 1,
· · Token: example192.c:1:19: CHARCONST "'a'",
· },
· Token: example192.c:1:10: '[',
· Token2: example192.c:1:12: STATIC "static",
· Token3: example192.c:1:23: ']',
}
Example (Case4)
fmt.Println(exampleAST(193, "\U00100001 ( _Bool [ const static 'a' ] ("))
Output:

&cc.DirectAbstractDeclarator{
· Case: 4,
· Expression: &cc.Expression{
· · Type: int,
· · Value: 97,
· · Case: 1,
· · Token: example193.c:1:25: CHARCONST "'a'",
· },
· Token: example193.c:1:10: '[',
· Token2: example193.c:1:18: STATIC "static",
· Token3: example193.c:1:29: ']',
· TypeQualifierList: &cc.TypeQualifierList{
· · TypeQualifier: &cc.TypeQualifier{
· · · Token: example193.c:1:12: CONST "const",
· · },
· },
}
Example (Case5)
fmt.Println(exampleAST(194, "\U00100001 ( _Bool [ * ] ("))
Output:

&cc.DirectAbstractDeclarator{
· Case: 5,
· Token: example194.c:1:10: '[',
· Token2: example194.c:1:12: '*',
· Token3: example194.c:1:14: ']',
}
Example (Case6)
fmt.Println(exampleAST(196, "\U00100001 ( _Bool ( ) ("))
Output:

&cc.DirectAbstractDeclarator{
· Case: 6,
· Token: example196.c:1:10: '(',
· Token2: example196.c:1:12: ')',
}
Example (Case7)
fmt.Println(exampleAST(198, "\U00100001 ( _Bool ( ) ( ) ("))
Output:

&cc.DirectAbstractDeclarator{
· Case: 7,
· DirectAbstractDeclarator: &cc.DirectAbstractDeclarator{
· · Case: 6,
· · Token: example198.c:1:10: '(',
· · Token2: example198.c:1:12: ')',
· },
· Token: example198.c:1:14: '(',
· Token2: example198.c:1:16: ')',
}

func (*DirectAbstractDeclarator) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DirectAbstractDeclarator) String

func (n *DirectAbstractDeclarator) String() string

String implements fmt.Stringer.

type DirectAbstractDeclaratorOpt

type DirectAbstractDeclaratorOpt struct {
	DirectAbstractDeclarator *DirectAbstractDeclarator
}

DirectAbstractDeclaratorOpt represents data reduced by productions:

DirectAbstractDeclaratorOpt:
        /* empty */
|       DirectAbstractDeclarator  // Case 1
Example
fmt.Println(exampleAST(199, "\U00100001 ( _Bool [") == (*DirectAbstractDeclaratorOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(200, "\U00100001 ( _Bool ( ) ["))
Output:

&cc.DirectAbstractDeclaratorOpt{
· DirectAbstractDeclarator: &cc.DirectAbstractDeclarator{
· · Case: 6,
· · Token: example200.c:1:10: '(',
· · Token2: example200.c:1:12: ')',
· },
}

func (*DirectAbstractDeclaratorOpt) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DirectAbstractDeclaratorOpt) String

func (n *DirectAbstractDeclaratorOpt) String() string

String implements fmt.Stringer.

type DirectDeclarator

type DirectDeclarator struct {
	EnumVal interface{} // Non nil if DD declares an enumeration constant.

	Case                 int
	Declarator           *Declarator
	DirectDeclarator     *DirectDeclarator
	Expression           *Expression
	ExpressionOpt        *ExpressionOpt
	IdentifierListOpt    *IdentifierListOpt
	ParameterTypeList    *ParameterTypeList
	Token                xc.Token
	Token2               xc.Token
	Token3               xc.Token
	TypeQualifierList    *TypeQualifierList
	TypeQualifierListOpt *TypeQualifierListOpt
	// contains filtered or unexported fields
}

DirectDeclarator represents data reduced by productions:

DirectDeclarator:
        IDENTIFIER
|       '(' Declarator ')'                                                 // Case 1
|       DirectDeclarator '[' TypeQualifierListOpt ExpressionOpt ']'        // Case 2
|       DirectDeclarator '[' "static" TypeQualifierListOpt Expression ']'  // Case 3
|       DirectDeclarator '[' TypeQualifierList "static" Expression ']'     // Case 4
|       DirectDeclarator '[' TypeQualifierListOpt '*' ']'                  // Case 5
|       DirectDeclarator '(' ParameterTypeList ')'                         // Case 6
|       DirectDeclarator '(' IdentifierListOpt ')'                         // Case 7
Example
fmt.Println(exampleAST(152, "\U00100002 a ("))
Output:

&cc.DirectDeclarator{
· Token: example152.c:1:2: IDENTIFIER "a",
}
Example (Case1)
fmt.Println(exampleAST(153, "\U00100002 ( a ) ("))
Output:

&cc.DirectDeclarator{
· Case: 1,
· Declarator: &cc.Declarator{
· · Linkage: None,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example153.c:1:4: IDENTIFIER "a",
· · },
· },
· Token: example153.c:1:2: '(',
· Token2: example153.c:1:6: ')',
}
Example (Case2)
fmt.Println(exampleAST(154, "\U00100002 a [ ] ("))
Output:

&cc.DirectDeclarator{
· Case: 2,
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: example154.c:1:2: IDENTIFIER "a",
· },
· Token: example154.c:1:4: '[',
· Token2: example154.c:1:6: ']',
}
Example (Case3)
fmt.Println(exampleAST(155, "\U00100002 a [ static 'b' ] ("))
Output:

&cc.DirectDeclarator{
· Case: 3,
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: example155.c:1:2: IDENTIFIER "a",
· },
· Expression: &cc.Expression{
· · Type: int,
· · Value: 98,
· · Case: 1,
· · Token: example155.c:1:13: CHARCONST "'b'",
· },
· Token: example155.c:1:4: '[',
· Token2: example155.c:1:6: STATIC "static",
· Token3: example155.c:1:17: ']',
}
Example (Case4)
fmt.Println(exampleAST(156, "\U00100002 a [ const static 'b' ] ("))
Output:

&cc.DirectDeclarator{
· Case: 4,
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: example156.c:1:2: IDENTIFIER "a",
· },
· Expression: &cc.Expression{
· · Type: int,
· · Value: 98,
· · Case: 1,
· · Token: example156.c:1:19: CHARCONST "'b'",
· },
· Token: example156.c:1:4: '[',
· Token2: example156.c:1:12: STATIC "static",
· Token3: example156.c:1:23: ']',
· TypeQualifierList: &cc.TypeQualifierList{
· · TypeQualifier: &cc.TypeQualifier{
· · · Token: example156.c:1:6: CONST "const",
· · },
· },
}
Example (Case5)
fmt.Println(exampleAST(157, "\U00100002 a [ * ] ("))
Output:

&cc.DirectDeclarator{
· Case: 5,
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: example157.c:1:2: IDENTIFIER "a",
· },
· Token: example157.c:1:4: '[',
· Token2: example157.c:1:6: '*',
· Token3: example157.c:1:8: ']',
}
Example (Case6)
fmt.Println(exampleAST(159, "\U00100002 a ( auto ) ("))
Output:

&cc.DirectDeclarator{
· Case: 6,
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: example159.c:1:2: IDENTIFIER "a",
· },
· ParameterTypeList: &cc.ParameterTypeList{
· · ParameterList: &cc.ParameterList{
· · · ParameterDeclaration: &cc.ParameterDeclaration{
· · · · Case: 1,
· · · · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · · · Case: 3,
· · · · · · Token: example159.c:1:6: AUTO "auto",
· · · · · },
· · · · },
· · · },
· · },
· },
· Token: example159.c:1:4: '(',
· Token2: example159.c:1:11: ')',
}
Example (Case7)
fmt.Println(exampleAST(160, "\U00100002 a ( ) ("))
Output:

&cc.DirectDeclarator{
· Case: 7,
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: example160.c:1:2: IDENTIFIER "a",
· },
· Token: example160.c:1:4: '(',
· Token2: example160.c:1:6: ')',
}

func (*DirectDeclarator) DeclarationScope

func (n *DirectDeclarator) DeclarationScope() *Bindings

DeclarationScope returns the scope a name declared by n is in. If n does not declare a name or n declares a name of a built in type, DeclarationScope returns nil.

func (*DirectDeclarator) Pos

func (n *DirectDeclarator) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*DirectDeclarator) String

func (n *DirectDeclarator) String() string

String implements fmt.Stringer.

func (*DirectDeclarator) TopDeclarator

func (n *DirectDeclarator) TopDeclarator() *Declarator

TopDeclarator returns the top level Declarator associated with n.

type ElifGroup

type ElifGroup struct {
	GroupListOpt *GroupListOpt
	PPTokenList  PPTokenList
	Token        xc.Token
	Token2       xc.Token
}

ElifGroup represents data reduced by production:

ElifGroup:
        PPELIF PPTokenList '\n' GroupListOpt
Example
fmt.Println(exampleAST(302, "\U00100000 \n#if other_a  \n#elif other_b  \n#elif"))
Output:

&cc.ElifGroup{
· PPTokenList: []xc.Token{ // len 4
· · 0: example302.c:3:6: ' ',
· · 1: example302.c:3:7: IDENTIFIER "other_b",
· · 2: example302.c:3:14: ' ',
· · 3: example302.c:3:16: ' ',
· },
· Token: example302.c:3:2: PPELIF,
· Token2: example302.c:3:16: '\n',
}

func (*ElifGroup) Pos

func (n *ElifGroup) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ElifGroup) String

func (n *ElifGroup) String() string

String implements fmt.Stringer.

type ElifGroupList

type ElifGroupList struct {
	Case          int
	ElifGroup     *ElifGroup
	ElifGroupList *ElifGroupList
}

ElifGroupList represents data reduced by productions:

ElifGroupList:
        ElifGroup
|       ElifGroupList ElifGroup  // Case 1
Example
fmt.Println(exampleAST(298, "\U00100000 \n#if other_a  \n#elif other_b  \n#elif"))
Output:

&cc.ElifGroupList{
· ElifGroup: &cc.ElifGroup{
· · PPTokenList: []xc.Token{ // len 4
· · · 0: example298.c:3:6: ' ',
· · · 1: example298.c:3:7: IDENTIFIER "other_b",
· · · 2: example298.c:3:14: ' ',
· · · 3: example298.c:3:16: ' ',
· · },
· · Token: example298.c:3:2: PPELIF,
· · Token2: example298.c:3:16: '\n',
· },
}
Example (Case1)
fmt.Println(exampleAST(299, "\U00100000 \n#if other_a  \n#elif other_b  \n#elif other_c  \n#elif"))
Output:

&cc.ElifGroupList{
· ElifGroup: &cc.ElifGroup{
· · PPTokenList: []xc.Token{ // len 4
· · · 0: example299.c:3:6: ' ',
· · · 1: example299.c:3:7: IDENTIFIER "other_b",
· · · 2: example299.c:3:14: ' ',
· · · 3: example299.c:3:16: ' ',
· · },
· · Token: example299.c:3:2: PPELIF,
· · Token2: example299.c:3:16: '\n',
· },
· ElifGroupList: &cc.ElifGroupList{
· · Case: 1,
· · ElifGroup: &cc.ElifGroup{
· · · PPTokenList: []xc.Token{ // len 4
· · · · 0: example299.c:4:6: ' ',
· · · · 1: example299.c:4:7: IDENTIFIER "other_c",
· · · · 2: example299.c:4:14: ' ',
· · · · 3: example299.c:4:16: ' ',
· · · },
· · · Token: example299.c:4:2: PPELIF,
· · · Token2: example299.c:4:16: '\n',
· · },
· },
}

func (*ElifGroupList) Pos

func (n *ElifGroupList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ElifGroupList) String

func (n *ElifGroupList) String() string

String implements fmt.Stringer.

type ElifGroupListOpt

type ElifGroupListOpt struct {
	ElifGroupList *ElifGroupList
}

ElifGroupListOpt represents data reduced by productions:

ElifGroupListOpt:
        /* empty */
|       ElifGroupList  // Case 1
Example
fmt.Println(exampleAST(300, "\U00100000 \n#if other_a  \n#else") == (*ElifGroupListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(301, "\U00100000 \n#if other_a  \n#elif other_b  \n#else"))
Output:

&cc.ElifGroupListOpt{
· ElifGroupList: &cc.ElifGroupList{
· · ElifGroup: &cc.ElifGroup{
· · · PPTokenList: []xc.Token{ // len 4
· · · · 0: example301.c:3:6: ' ',
· · · · 1: example301.c:3:7: IDENTIFIER "other_b",
· · · · 2: example301.c:3:14: ' ',
· · · · 3: example301.c:3:16: ' ',
· · · },
· · · Token: example301.c:3:2: PPELIF,
· · · Token2: example301.c:3:16: '\n',
· · },
· },
}

func (*ElifGroupListOpt) Pos

func (n *ElifGroupListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ElifGroupListOpt) String

func (n *ElifGroupListOpt) String() string

String implements fmt.Stringer.

type ElseGroup

type ElseGroup struct {
	GroupListOpt *GroupListOpt
	Token        xc.Token
	Token2       xc.Token
}

ElseGroup represents data reduced by production:

ElseGroup:
        PPELSE '\n' GroupListOpt
Example
fmt.Println(exampleAST(303, "\U00100000 \n#if other_a  \n#else  \n#endif"))
Output:

&cc.ElseGroup{
· Token: example303.c:3:2: PPELSE,
· Token2: example303.c:3:8: '\n',
}

func (*ElseGroup) Pos

func (n *ElseGroup) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ElseGroup) String

func (n *ElseGroup) String() string

String implements fmt.Stringer.

type ElseGroupOpt

type ElseGroupOpt struct {
	ElseGroup *ElseGroup
}

ElseGroupOpt represents data reduced by productions:

ElseGroupOpt:
        /* empty */
|       ElseGroup    // Case 1
Example
fmt.Println(exampleAST(304, "\U00100000 \n#if other_a  \n#endif") == (*ElseGroupOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(305, "\U00100000 \n#if other_a  \n#else  \n#endif"))
Output:

&cc.ElseGroupOpt{
· ElseGroup: &cc.ElseGroup{
· · Token: example305.c:3:2: PPELSE,
· · Token2: example305.c:3:8: '\n',
· },
}

func (*ElseGroupOpt) Pos

func (n *ElseGroupOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ElseGroupOpt) String

func (n *ElseGroupOpt) String() string

String implements fmt.Stringer.

type EndifLine

type EndifLine struct {
	Token xc.Token
}

EndifLine represents data reduced by production:

EndifLine:
        PPENDIF
Example
fmt.Println(exampleAST(306, "\U00100000 \n#if other_a  \n#endif"))
Output:

&cc.EndifLine{
· Token: example306.c:3:2: PPENDIF,
}

func (*EndifLine) Pos

func (n *EndifLine) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*EndifLine) String

func (n *EndifLine) String() string

String implements fmt.Stringer.

type EnumConstant

type EnumConstant struct {
	DefTok xc.Token    // Enumeration constant name definition token.
	Value  interface{} // Value represented by name. Type of Value is C int.
	Tokens []xc.Token  // The tokens the constant expression consists of.
}

EnumConstant represents the name/value pair defined by an Enumerator.

type EnumSpecifier

type EnumSpecifier struct {
	Case           int
	CommaOpt       *CommaOpt
	EnumeratorList *EnumeratorList
	IdentifierOpt  *IdentifierOpt
	Token          xc.Token
	Token2         xc.Token
	Token3         xc.Token
	// contains filtered or unexported fields
}

EnumSpecifier represents data reduced by productions:

EnumSpecifier:
        "enum" IdentifierOpt '{' EnumeratorList CommaOpt '}'
|       "enum" IDENTIFIER                                     // Case 1
Example
fmt.Println(exampleAST(138, "\U00100002 enum { a } ("))
Output:

&cc.EnumSpecifier{
· EnumeratorList: &cc.EnumeratorList{
· · Enumerator: &cc.Enumerator{
· · · EnumerationConstant: &cc.EnumerationConstant{
· · · · Token: example138.c:1:9: IDENTIFIER "a",
· · · },
· · },
· },
· Token: example138.c:1:2: ENUM "enum",
· Token2: example138.c:1:7: '{',
· Token3: example138.c:1:11: '}',
}
Example (Case1)
fmt.Println(exampleAST(139, "\U00100002 enum a ("))
Output:

&cc.EnumSpecifier{
· Case: 1,
· Token: example139.c:1:2: ENUM "enum",
· Token2: example139.c:1:7: IDENTIFIER "a",
}

func (*EnumSpecifier) Pos

func (n *EnumSpecifier) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*EnumSpecifier) String

func (n *EnumSpecifier) String() string

String implements fmt.Stringer.

type EnumerationConstant

type EnumerationConstant struct {
	Token xc.Token
}

EnumerationConstant represents data reduced by production:

EnumerationConstant:
        IDENTIFIER
Example
fmt.Println(exampleAST(7, "\U00100002 enum { a ,"))
Output:

&cc.EnumerationConstant{
· Token: example7.c:1:9: IDENTIFIER "a",
}

func (*EnumerationConstant) Pos

func (n *EnumerationConstant) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*EnumerationConstant) String

func (n *EnumerationConstant) String() string

String implements fmt.Stringer.

type Enumerator

type Enumerator struct {
	Value               interface{} // Enumerator's value.
	Case                int
	ConstantExpression  *ConstantExpression
	EnumerationConstant *EnumerationConstant
	Token               xc.Token
}

Enumerator represents data reduced by productions:

Enumerator:
        EnumerationConstant
|       EnumerationConstant '=' ConstantExpression  // Case 1
Example
fmt.Println(exampleAST(142, "\U00100002 enum { a ,"))
Output:

&cc.Enumerator{
· EnumerationConstant: &cc.EnumerationConstant{
· · Token: example142.c:1:9: IDENTIFIER "a",
· },
}
Example (Case1)
fmt.Println(exampleAST(143, "\U00100002 enum { a = 'b' ,"))
Output:

&cc.Enumerator{
· Value: 98,
· Case: 1,
· ConstantExpression: &cc.ConstantExpression{
· · Type: int,
· · Value: 98,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 98,
· · · Case: 1,
· · · Token: example143.c:1:13: CHARCONST "'b'",
· · },
· },
· EnumerationConstant: &cc.EnumerationConstant{
· · Token: example143.c:1:9: IDENTIFIER "a",
· },
· Token: example143.c:1:11: '=',
}

func (*Enumerator) Pos

func (n *Enumerator) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Enumerator) String

func (n *Enumerator) String() string

String implements fmt.Stringer.

type EnumeratorList

type EnumeratorList struct {
	Case           int
	Enumerator     *Enumerator
	EnumeratorList *EnumeratorList
	Token          xc.Token
}

EnumeratorList represents data reduced by productions:

EnumeratorList:
        Enumerator
|       EnumeratorList ',' Enumerator  // Case 1
Example
fmt.Println(exampleAST(140, "\U00100002 enum { a ,"))
Output:

&cc.EnumeratorList{
· Enumerator: &cc.Enumerator{
· · EnumerationConstant: &cc.EnumerationConstant{
· · · Token: example140.c:1:9: IDENTIFIER "a",
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(141, "\U00100002 enum { a , b ,"))
Output:

&cc.EnumeratorList{
· Enumerator: &cc.Enumerator{
· · EnumerationConstant: &cc.EnumerationConstant{
· · · Token: example141.c:1:9: IDENTIFIER "a",
· · },
· },
· EnumeratorList: &cc.EnumeratorList{
· · Case: 1,
· · Enumerator: &cc.Enumerator{
· · · Value: 1,
· · · EnumerationConstant: &cc.EnumerationConstant{
· · · · Token: example141.c:1:13: IDENTIFIER "b",
· · · },
· · },
· · Token: example141.c:1:11: ',',
· },
}

func (*EnumeratorList) Pos

func (n *EnumeratorList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*EnumeratorList) String

func (n *EnumeratorList) String() string

String implements fmt.Stringer.

type Expression

type Expression struct {
	BinOpType Type        // The type operands of binary expression are coerced into, if different from Type.
	Type      Type        // Type of expression.
	Value     interface{} // Non nil for certain constant expressions.

	ArgumentExpressionListOpt *ArgumentExpressionListOpt
	Case                      int
	CommaOpt                  *CommaOpt
	CompoundStatement         *CompoundStatement
	Expression                *Expression
	Expression2               *Expression
	ExpressionList            *ExpressionList
	InitializerList           *InitializerList
	Token                     xc.Token
	Token2                    xc.Token
	Token3                    xc.Token
	Token4                    xc.Token
	TypeName                  *TypeName
	// contains filtered or unexported fields
}

Expression represents data reduced by productions:

Expression:
        IDENTIFIER
|       CHARCONST                                          // Case 1
|       FLOATCONST                                         // Case 2
|       INTCONST                                           // Case 3
|       LONGCHARCONST                                      // Case 4
|       LONGSTRINGLITERAL                                  // Case 5
|       STRINGLITERAL                                      // Case 6
|       '(' ExpressionList ')'                             // Case 7
|       Expression '[' ExpressionList ']'                  // Case 8
|       Expression '(' ArgumentExpressionListOpt ')'       // Case 9
|       Expression '.' IDENTIFIER                          // Case 10
|       Expression "->" IDENTIFIER                         // Case 11
|       Expression "++"                                    // Case 12
|       Expression "--"                                    // Case 13
|       '(' TypeName ')' '{' InitializerList CommaOpt '}'  // Case 14
|       "++" Expression                                    // Case 15
|       "--" Expression                                    // Case 16
|       '&' Expression                                     // Case 17
|       '*' Expression                                     // Case 18
|       '+' Expression                                     // Case 19
|       '-' Expression                                     // Case 20
|       '~' Expression                                     // Case 21
|       '!' Expression                                     // Case 22
|       "sizeof" Expression                                // Case 23
|       "sizeof" '(' TypeName ')'                          // Case 24
|       '(' TypeName ')' Expression                        // Case 25
|       Expression '*' Expression                          // Case 26
|       Expression '/' Expression                          // Case 27
|       Expression '%' Expression                          // Case 28
|       Expression '+' Expression                          // Case 29
|       Expression '-' Expression                          // Case 30
|       Expression "<<" Expression                         // Case 31
|       Expression ">>" Expression                         // Case 32
|       Expression '<' Expression                          // Case 33
|       Expression '>' Expression                          // Case 34
|       Expression "<=" Expression                         // Case 35
|       Expression ">=" Expression                         // Case 36
|       Expression "==" Expression                         // Case 37
|       Expression "!=" Expression                         // Case 38
|       Expression '&' Expression                          // Case 39
|       Expression '^' Expression                          // Case 40
|       Expression '|' Expression                          // Case 41
|       Expression "&&" Expression                         // Case 42
|       Expression "||" Expression                         // Case 43
|       Expression '?' ExpressionList ':' Expression       // Case 44
|       Expression '=' Expression                          // Case 45
|       Expression "*=" Expression                         // Case 46
|       Expression "/=" Expression                         // Case 47
|       Expression "%=" Expression                         // Case 48
|       Expression "+=" Expression                         // Case 49
|       Expression "-=" Expression                         // Case 50
|       Expression "<<=" Expression                        // Case 51
|       Expression ">>=" Expression                        // Case 52
|       Expression "&=" Expression                         // Case 53
|       Expression "^=" Expression                         // Case 54
|       Expression "|=" Expression                         // Case 55
|       "_Alignof" '(' TypeName ')'                        // Case 56
|       '(' CompoundStatement ')'                          // Case 57
|       "&&" IDENTIFIER                                    // Case 58
|       Expression '?' ':' Expression                      // Case 59
Example
fmt.Println(exampleAST(12, "\U00100001 a"))
Output:

&cc.Expression{
· Token: example12.c:1:2: IDENTIFIER "a",
}
Example (Case01)
fmt.Println(exampleAST(13, "\U00100001 'a'"))
Output:

&cc.Expression{
· Case: 1,
· Token: example13.c:1:2: CHARCONST "'a'",
}
Example (Case02)
fmt.Println(exampleAST(14, "\U00100001 1.97"))
Output:

&cc.Expression{
· Case: 2,
· Token: example14.c:1:2: FLOATCONST "1.97",
}
Example (Case03)
fmt.Println(exampleAST(15, "\U00100001 97"))
Output:

&cc.Expression{
· Case: 3,
· Token: example15.c:1:2: INTCONST "97",
}
Example (Case04)
fmt.Println(exampleAST(16, "\U00100001 L'a'"))
Output:

&cc.Expression{
· Case: 4,
· Token: example16.c:1:2: LONGCHARCONST "L'a'",
}
Example (Case05)
fmt.Println(exampleAST(17, "\U00100001 L\"a\""))
Output:

&cc.Expression{
· Case: 5,
· Token: example17.c:1:2: LONGSTRINGLITERAL "L\"a\"",
}
Example (Case06)
fmt.Println(exampleAST(18, "\U00100001 \"a\""))
Output:

&cc.Expression{
· Case: 6,
· Token: example18.c:1:2: STRINGLITERAL "\"a\"",
}
Example (Case07)
fmt.Println(exampleAST(19, "\U00100001 ( 'a' )"))
Output:

&cc.Expression{
· Case: 7,
· ExpressionList: &cc.ExpressionList{
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example19.c:1:4: CHARCONST "'a'",
· · },
· },
· Token: example19.c:1:2: '(',
· Token2: example19.c:1:8: ')',
}
Example (Case08)
fmt.Println(exampleAST(20, "\U00100001 'a' [ 'b' ]"))
Output:

&cc.Expression{
· Case: 8,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example20.c:1:2: CHARCONST "'a'",
· },
· ExpressionList: &cc.ExpressionList{
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example20.c:1:8: CHARCONST "'b'",
· · },
· },
· Token: example20.c:1:6: '[',
· Token2: example20.c:1:12: ']',
}
Example (Case09)
fmt.Println(exampleAST(21, "\U00100001 'a' ( )"))
Output:

&cc.Expression{
· Case: 9,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example21.c:1:2: CHARCONST "'a'",
· },
· Token: example21.c:1:6: '(',
· Token2: example21.c:1:8: ')',
}
Example (Case10)
fmt.Println(exampleAST(22, "\U00100001 'a' . b"))
Output:

&cc.Expression{
· Case: 10,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example22.c:1:2: CHARCONST "'a'",
· },
· Token: example22.c:1:6: '.',
· Token2: example22.c:1:8: IDENTIFIER "b",
}
Example (Case11)
fmt.Println(exampleAST(23, "\U00100001 'a' -> b"))
Output:

&cc.Expression{
· Case: 11,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example23.c:1:2: CHARCONST "'a'",
· },
· Token: example23.c:1:6: ARROW,
· Token2: example23.c:1:9: IDENTIFIER "b",
}
Example (Case12)
fmt.Println(exampleAST(24, "\U00100001 'a' ++"))
Output:

&cc.Expression{
· Case: 12,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example24.c:1:2: CHARCONST "'a'",
· },
· Token: example24.c:1:6: INC,
}
Example (Case13)
fmt.Println(exampleAST(25, "\U00100001 'a' --"))
Output:

&cc.Expression{
· Case: 13,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example25.c:1:2: CHARCONST "'a'",
· },
· Token: example25.c:1:6: DEC,
}
Example (Case14)
fmt.Println(exampleAST(26, "\U00100001 ( _Bool ) { }"))
Output:

&cc.Expression{
· Case: 14,
· Token: example26.c:1:2: '(',
· Token2: example26.c:1:10: ')',
· Token3: example26.c:1:12: '{',
· Token4: example26.c:1:14: '}',
· TypeName: &cc.TypeName{
· · Type: bool,
· · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · TypeSpecifier: &cc.TypeSpecifier{
· · · · Case: 9,
· · · · Token: example26.c:1:4: BOOL "_Bool",
· · · },
· · },
· },
}
Example (Case15)
fmt.Println(exampleAST(27, "\U00100001 ++ 'a'"))
Output:

&cc.Expression{
· Case: 15,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example27.c:1:5: CHARCONST "'a'",
· },
· Token: example27.c:1:2: INC,
}
Example (Case16)
fmt.Println(exampleAST(28, "\U00100001 -- 'a'"))
Output:

&cc.Expression{
· Case: 16,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example28.c:1:5: CHARCONST "'a'",
· },
· Token: example28.c:1:2: DEC,
}
Example (Case17)
fmt.Println(exampleAST(29, "\U00100001 & 'a'"))
Output:

&cc.Expression{
· Case: 17,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example29.c:1:4: CHARCONST "'a'",
· },
· Token: example29.c:1:2: '&',
}
Example (Case18)
fmt.Println(exampleAST(30, "\U00100001 * 'a'"))
Output:

&cc.Expression{
· Case: 18,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example30.c:1:4: CHARCONST "'a'",
· },
· Token: example30.c:1:2: '*',
}
Example (Case19)
fmt.Println(exampleAST(31, "\U00100001 + 'a'"))
Output:

&cc.Expression{
· Case: 19,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example31.c:1:4: CHARCONST "'a'",
· },
· Token: example31.c:1:2: '+',
}
Example (Case20)
fmt.Println(exampleAST(32, "\U00100001 - 'a'"))
Output:

&cc.Expression{
· Case: 20,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example32.c:1:4: CHARCONST "'a'",
· },
· Token: example32.c:1:2: '-',
}
Example (Case21)
fmt.Println(exampleAST(33, "\U00100001 ~ 'a'"))
Output:

&cc.Expression{
· Case: 21,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example33.c:1:4: CHARCONST "'a'",
· },
· Token: example33.c:1:2: '~',
}
Example (Case22)
fmt.Println(exampleAST(34, "\U00100001 ! 'a'"))
Output:

&cc.Expression{
· Case: 22,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example34.c:1:4: CHARCONST "'a'",
· },
· Token: example34.c:1:2: '!',
}
Example (Case23)
fmt.Println(exampleAST(35, "\U00100001 sizeof 'a'"))
Output:

&cc.Expression{
· Case: 23,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example35.c:1:9: CHARCONST "'a'",
· },
· Token: example35.c:1:2: SIZEOF "sizeof",
}
Example (Case24)
fmt.Println(exampleAST(36, "\U00100001 sizeof ( _Bool )"))
Output:

&cc.Expression{
· Case: 24,
· Token: example36.c:1:2: SIZEOF "sizeof",
· Token2: example36.c:1:9: '(',
· Token3: example36.c:1:17: ')',
· TypeName: &cc.TypeName{
· · Type: bool,
· · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · TypeSpecifier: &cc.TypeSpecifier{
· · · · Case: 9,
· · · · Token: example36.c:1:11: BOOL "_Bool",
· · · },
· · },
· },
}
Example (Case25)
fmt.Println(exampleAST(37, "\U00100001 ( _Bool ) 'a'"))
Output:

&cc.Expression{
· Case: 25,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example37.c:1:12: CHARCONST "'a'",
· },
· Token: example37.c:1:2: '(',
· Token2: example37.c:1:10: ')',
· TypeName: &cc.TypeName{
· · Type: bool,
· · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · TypeSpecifier: &cc.TypeSpecifier{
· · · · Case: 9,
· · · · Token: example37.c:1:4: BOOL "_Bool",
· · · },
· · },
· },
}
Example (Case26)
fmt.Println(exampleAST(38, "\U00100001 'a' * 'b'"))
Output:

&cc.Expression{
· Case: 26,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example38.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example38.c:1:8: CHARCONST "'b'",
· },
· Token: example38.c:1:6: '*',
}
Example (Case27)
fmt.Println(exampleAST(39, "\U00100001 'a' / 'b'"))
Output:

&cc.Expression{
· Case: 27,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example39.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example39.c:1:8: CHARCONST "'b'",
· },
· Token: example39.c:1:6: '/',
}
Example (Case28)
fmt.Println(exampleAST(40, "\U00100001 'a' % 'b'"))
Output:

&cc.Expression{
· Case: 28,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example40.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example40.c:1:8: CHARCONST "'b'",
· },
· Token: example40.c:1:6: '%',
}
Example (Case29)
fmt.Println(exampleAST(41, "\U00100001 'a' + 'b'"))
Output:

&cc.Expression{
· Case: 29,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example41.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example41.c:1:8: CHARCONST "'b'",
· },
· Token: example41.c:1:6: '+',
}
Example (Case30)
fmt.Println(exampleAST(42, "\U00100001 'a' - 'b'"))
Output:

&cc.Expression{
· Case: 30,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example42.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example42.c:1:8: CHARCONST "'b'",
· },
· Token: example42.c:1:6: '-',
}
Example (Case31)
fmt.Println(exampleAST(43, "\U00100001 'a' << 'b'"))
Output:

&cc.Expression{
· Case: 31,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example43.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example43.c:1:9: CHARCONST "'b'",
· },
· Token: example43.c:1:6: LSH,
}
Example (Case32)
fmt.Println(exampleAST(44, "\U00100001 'a' >> 'b'"))
Output:

&cc.Expression{
· Case: 32,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example44.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example44.c:1:9: CHARCONST "'b'",
· },
· Token: example44.c:1:6: RSH,
}
Example (Case33)
fmt.Println(exampleAST(45, "\U00100001 'a' < 'b'"))
Output:

&cc.Expression{
· Case: 33,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example45.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example45.c:1:8: CHARCONST "'b'",
· },
· Token: example45.c:1:6: '<',
}
Example (Case34)
fmt.Println(exampleAST(46, "\U00100001 'a' > 'b'"))
Output:

&cc.Expression{
· Case: 34,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example46.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example46.c:1:8: CHARCONST "'b'",
· },
· Token: example46.c:1:6: '>',
}
Example (Case35)
fmt.Println(exampleAST(47, "\U00100001 'a' <= 'b'"))
Output:

&cc.Expression{
· Case: 35,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example47.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example47.c:1:9: CHARCONST "'b'",
· },
· Token: example47.c:1:6: LEQ,
}
Example (Case36)
fmt.Println(exampleAST(48, "\U00100001 'a' >= 'b'"))
Output:

&cc.Expression{
· Case: 36,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example48.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example48.c:1:9: CHARCONST "'b'",
· },
· Token: example48.c:1:6: GEQ,
}
Example (Case37)
fmt.Println(exampleAST(49, "\U00100001 'a' == 'b'"))
Output:

&cc.Expression{
· Case: 37,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example49.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example49.c:1:9: CHARCONST "'b'",
· },
· Token: example49.c:1:6: EQ,
}
Example (Case38)
fmt.Println(exampleAST(50, "\U00100001 'a' != 'b'"))
Output:

&cc.Expression{
· Case: 38,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example50.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example50.c:1:9: CHARCONST "'b'",
· },
· Token: example50.c:1:6: NEQ,
}
Example (Case39)
fmt.Println(exampleAST(51, "\U00100001 'a' & 'b'"))
Output:

&cc.Expression{
· Case: 39,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example51.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example51.c:1:8: CHARCONST "'b'",
· },
· Token: example51.c:1:6: '&',
}
Example (Case40)
fmt.Println(exampleAST(52, "\U00100001 'a' ^ 'b'"))
Output:

&cc.Expression{
· Case: 40,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example52.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example52.c:1:8: CHARCONST "'b'",
· },
· Token: example52.c:1:6: '^',
}
Example (Case41)
fmt.Println(exampleAST(53, "\U00100001 'a' | 'b'"))
Output:

&cc.Expression{
· Case: 41,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example53.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example53.c:1:8: CHARCONST "'b'",
· },
· Token: example53.c:1:6: '|',
}
Example (Case42)
fmt.Println(exampleAST(54, "\U00100001 'a' && 'b'"))
Output:

&cc.Expression{
· Case: 42,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example54.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example54.c:1:9: CHARCONST "'b'",
· },
· Token: example54.c:1:6: ANDAND,
}
Example (Case43)
fmt.Println(exampleAST(55, "\U00100001 'a' || 'b'"))
Output:

&cc.Expression{
· Case: 43,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example55.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example55.c:1:9: CHARCONST "'b'",
· },
· Token: example55.c:1:6: OROR,
}
Example (Case44)
fmt.Println(exampleAST(56, "\U00100001 'a' ? 'b' : 'c'"))
Output:

&cc.Expression{
· Case: 44,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example56.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example56.c:1:14: CHARCONST "'c'",
· },
· ExpressionList: &cc.ExpressionList{
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example56.c:1:8: CHARCONST "'b'",
· · },
· },
· Token: example56.c:1:6: '?',
· Token2: example56.c:1:12: ':',
}
Example (Case45)
fmt.Println(exampleAST(57, "\U00100001 'a' = 'b'"))
Output:

&cc.Expression{
· Case: 45,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example57.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example57.c:1:8: CHARCONST "'b'",
· },
· Token: example57.c:1:6: '=',
}
Example (Case46)
fmt.Println(exampleAST(58, "\U00100001 'a' *= 'b'"))
Output:

&cc.Expression{
· Case: 46,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example58.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example58.c:1:9: CHARCONST "'b'",
· },
· Token: example58.c:1:6: MULASSIGN,
}
Example (Case47)
fmt.Println(exampleAST(59, "\U00100001 'a' /= 'b'"))
Output:

&cc.Expression{
· Case: 47,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example59.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example59.c:1:9: CHARCONST "'b'",
· },
· Token: example59.c:1:6: DIVASSIGN,
}
Example (Case48)
fmt.Println(exampleAST(60, "\U00100001 'a' %= 'b'"))
Output:

&cc.Expression{
· Case: 48,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example60.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example60.c:1:9: CHARCONST "'b'",
· },
· Token: example60.c:1:6: MODASSIGN,
}
Example (Case49)
fmt.Println(exampleAST(61, "\U00100001 'a' += 'b'"))
Output:

&cc.Expression{
· Case: 49,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example61.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example61.c:1:9: CHARCONST "'b'",
· },
· Token: example61.c:1:6: ADDASSIGN,
}
Example (Case50)
fmt.Println(exampleAST(62, "\U00100001 'a' -= 'b'"))
Output:

&cc.Expression{
· Case: 50,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example62.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example62.c:1:9: CHARCONST "'b'",
· },
· Token: example62.c:1:6: SUBASSIGN,
}
Example (Case51)
fmt.Println(exampleAST(63, "\U00100001 'a' <<= 'b'"))
Output:

&cc.Expression{
· Case: 51,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example63.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example63.c:1:10: CHARCONST "'b'",
· },
· Token: example63.c:1:6: LSHASSIGN,
}
Example (Case52)
fmt.Println(exampleAST(64, "\U00100001 'a' >>= 'b'"))
Output:

&cc.Expression{
· Case: 52,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example64.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example64.c:1:10: CHARCONST "'b'",
· },
· Token: example64.c:1:6: RSHASSIGN,
}
Example (Case53)
fmt.Println(exampleAST(65, "\U00100001 'a' &= 'b'"))
Output:

&cc.Expression{
· Case: 53,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example65.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example65.c:1:9: CHARCONST "'b'",
· },
· Token: example65.c:1:6: ANDASSIGN,
}
Example (Case54)
fmt.Println(exampleAST(66, "\U00100001 'a' ^= 'b'"))
Output:

&cc.Expression{
· Case: 54,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example66.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example66.c:1:9: CHARCONST "'b'",
· },
· Token: example66.c:1:6: XORASSIGN,
}
Example (Case55)
fmt.Println(exampleAST(67, "\U00100001 'a' |= 'b'"))
Output:

&cc.Expression{
· Case: 55,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example67.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example67.c:1:9: CHARCONST "'b'",
· },
· Token: example67.c:1:6: ORASSIGN,
}
Example (Case56)
fmt.Println(exampleAST(68, "\U00100001 _Alignof ( _Bool )"))
Output:

&cc.Expression{
· Case: 56,
· Token: example68.c:1:2: ALIGNOF "_Alignof",
· Token2: example68.c:1:11: '(',
· Token3: example68.c:1:19: ')',
· TypeName: &cc.TypeName{
· · Type: bool,
· · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · TypeSpecifier: &cc.TypeSpecifier{
· · · · Case: 9,
· · · · Token: example68.c:1:13: BOOL "_Bool",
· · · },
· · },
· },
}
Example (Case57)
fmt.Println(exampleAST(69, "\U00100001 ( { } )"))
Output:

&cc.Expression{
· Case: 57,
· CompoundStatement: &cc.CompoundStatement{
· · Token: example69.c:1:4: '{',
· · Token2: example69.c:1:6: '}',
· },
· Token: example69.c:1:2: '(',
· Token2: example69.c:1:8: ')',
}
Example (Case58)
fmt.Println(exampleAST(70, "\U00100001 && a"))
Output:

&cc.Expression{
· Case: 58,
· Token: example70.c:1:2: ANDAND,
· Token2: example70.c:1:5: IDENTIFIER "a",
}
Example (Case59)
fmt.Println(exampleAST(71, "\U00100001 'a' ? : 'b'"))
Output:

&cc.Expression{
· Case: 59,
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example71.c:1:2: CHARCONST "'a'",
· },
· Expression2: &cc.Expression{
· · Case: 1,
· · Token: example71.c:1:10: CHARCONST "'b'",
· },
· Token: example71.c:1:6: '?',
· Token2: example71.c:1:8: ':',
}

func (*Expression) IdentResolutionScope

func (n *Expression) IdentResolutionScope() *Bindings

IdentResolutionScope returns the scope an identifier is resolved in. If n is not an identifier (n.Case == 0), IdentResolutionScope returns nil.

func (*Expression) Pos

func (n *Expression) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Expression) String

func (n *Expression) String() string

String implements fmt.Stringer.

type ExpressionList

type ExpressionList struct {
	Type           Type        // Type of expression.
	Value          interface{} // Non nil for certain constant expressions.
	Case           int
	Expression     *Expression
	ExpressionList *ExpressionList
	Token          xc.Token
}

ExpressionList represents data reduced by productions:

ExpressionList:
        Expression
|       ExpressionList ',' Expression  // Case 1
Example
fmt.Println(exampleAST(74, "\U00100001 ( 'a' )"))
Output:

&cc.ExpressionList{
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example74.c:1:4: CHARCONST "'a'",
· },
}
Example (Case1)
fmt.Println(exampleAST(75, "\U00100001 ( 'a' , 'b' )"))
Output:

&cc.ExpressionList{
· Expression: &cc.Expression{
· · Case: 1,
· · Token: example75.c:1:4: CHARCONST "'a'",
· },
· ExpressionList: &cc.ExpressionList{
· · Case: 1,
· · Expression: &cc.Expression{
· · · Case: 1,
· · · Token: example75.c:1:10: CHARCONST "'b'",
· · },
· · Token: example75.c:1:8: ',',
· },
}

func (*ExpressionList) Len

func (n *ExpressionList) Len() (r int)

Len returns the number of items in n.

func (*ExpressionList) Pos

func (n *ExpressionList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ExpressionList) String

func (n *ExpressionList) String() string

String implements fmt.Stringer.

type ExpressionListOpt

type ExpressionListOpt struct {
	ExpressionList *ExpressionList
}

ExpressionListOpt represents data reduced by productions:

ExpressionListOpt:
        /* empty */
|       ExpressionList  // Case 1
Example
fmt.Println(exampleAST(76, "\U00100001 ( { ;") == (*ExpressionListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(77, "\U00100001 ( { 'a' )"))
Output:

&cc.ExpressionListOpt{
· ExpressionList: &cc.ExpressionList{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example77.c:1:6: CHARCONST "'a'",
· · },
· },
}

func (*ExpressionListOpt) Pos

func (n *ExpressionListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ExpressionListOpt) String

func (n *ExpressionListOpt) String() string

String implements fmt.Stringer.

type ExpressionOpt

type ExpressionOpt struct {
	Expression *Expression
}

ExpressionOpt represents data reduced by productions:

ExpressionOpt:
        /* empty */
|       Expression   // Case 1
Example
fmt.Println(exampleAST(72, "\U00100001 ( _Bool [ ]") == (*ExpressionOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(73, "\U00100002 a [ 'b' ]"))
Output:

&cc.ExpressionOpt{
· Expression: &cc.Expression{
· · Type: int,
· · Value: 98,
· · Case: 1,
· · Token: example73.c:1:6: CHARCONST "'b'",
· },
}

func (*ExpressionOpt) Pos

func (n *ExpressionOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ExpressionOpt) String

func (n *ExpressionOpt) String() string

String implements fmt.Stringer.

type ExpressionStatement

type ExpressionStatement struct {
	ExpressionListOpt *ExpressionListOpt
	Token             xc.Token
}

ExpressionStatement represents data reduced by production:

ExpressionStatement:
        ExpressionListOpt ';'
Example
fmt.Println(exampleAST(232, "\U00100001 ( { ; !"))
Output:

&cc.ExpressionStatement{
· Token: example232.c:1:6: ';',
}

func (*ExpressionStatement) Pos

func (n *ExpressionStatement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ExpressionStatement) String

func (n *ExpressionStatement) String() string

String implements fmt.Stringer.

type ExternalDeclaration

type ExternalDeclaration struct {
	BasicAssemblerStatement *BasicAssemblerStatement
	Case                    int
	Declaration             *Declaration
	FunctionDefinition      *FunctionDefinition
	Token                   xc.Token
}

ExternalDeclaration represents data reduced by productions:

ExternalDeclaration:
        FunctionDefinition
|       Declaration                  // Case 1
|       BasicAssemblerStatement ';'  // Case 2
|       ';'                          // Case 3
Example
fmt.Println(exampleAST(247, "\U00100002 a { }"))
Output:

&cc.ExternalDeclaration{
· FunctionDefinition: &cc.FunctionDefinition{
· · Case: 1,
· · Declarator: &cc.Declarator{
· · · Linkage: External,
· · · Type: int,
· · · DirectDeclarator: &cc.DirectDeclarator{
· · · · Token: example247.c:1:2: IDENTIFIER "a",
· · · },
· · },
· · FunctionBody: &cc.FunctionBody{
· · · CompoundStatement: &cc.CompoundStatement{
· · · · Token: example247.c:1:4: '{',
· · · · Token2: example247.c:1:6: '}',
· · · },
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(248, "\U00100002 auto ;"))
Output:

&cc.ExternalDeclaration{
· Case: 1,
· Declaration: &cc.Declaration{
· · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · Case: 3,
· · · · Token: example248.c:1:2: AUTO "auto",
· · · },
· · },
· · Token: example248.c:1:7: ';',
· },
}
Example (Case2)
fmt.Println(exampleAST(249, "\U00100002 asm ( \"a\" ) ;"))
Output:

&cc.ExternalDeclaration{
· BasicAssemblerStatement: &cc.BasicAssemblerStatement{
· · AssemblerInstructions: &cc.AssemblerInstructions{
· · · Token: example249.c:1:8: STRINGLITERAL "\"a\"",
· · },
· · Token: example249.c:1:2: ASM "asm",
· · Token2: example249.c:1:6: '(',
· · Token3: example249.c:1:12: ')',
· },
· Case: 2,
· Token: example249.c:1:14: ';',
}
Example (Case3)
fmt.Println(exampleAST(250, "\U00100002 ;"))
Output:

&cc.ExternalDeclaration{
· Case: 3,
· Token: example250.c:1:2: ';',
}

func (*ExternalDeclaration) Pos

func (n *ExternalDeclaration) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ExternalDeclaration) String

func (n *ExternalDeclaration) String() string

String implements fmt.Stringer.

type FunctionBody

type FunctionBody struct {
	AssemblerStatement *AssemblerStatement
	Case               int
	CompoundStatement  *CompoundStatement
	Token              xc.Token
	// contains filtered or unexported fields
}

FunctionBody represents data reduced by productions:

FunctionBody:
        CompoundStatement
|       AssemblerStatement ';'  // Case 1
Example
fmt.Println(exampleAST(257, "\U00100002 a { }"))
Output:

&cc.FunctionBody{
· CompoundStatement: &cc.CompoundStatement{
· · Token: example257.c:1:4: '{',
· · Token2: example257.c:1:6: '}',
· },
}
Example (Case1)
fmt.Println(exampleAST(259, "\U00100002 a asm ( \"b\" ) ;"))
Output:

&cc.FunctionBody{
· AssemblerStatement: &cc.AssemblerStatement{
· · BasicAssemblerStatement: &cc.BasicAssemblerStatement{
· · · AssemblerInstructions: &cc.AssemblerInstructions{
· · · · Token: example259.c:1:10: STRINGLITERAL "\"b\"",
· · · },
· · · Token: example259.c:1:4: ASM "asm",
· · · Token2: example259.c:1:8: '(',
· · · Token3: example259.c:1:14: ')',
· · },
· },
· Case: 1,
· Token: example259.c:1:16: ';',
}

func (*FunctionBody) Pos

func (n *FunctionBody) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*FunctionBody) String

func (n *FunctionBody) String() string

String implements fmt.Stringer.

type FunctionDefinition

type FunctionDefinition struct {
	Case                  int
	DeclarationListOpt    *DeclarationListOpt
	DeclarationSpecifiers *DeclarationSpecifiers
	Declarator            *Declarator
	FunctionBody          *FunctionBody
}

FunctionDefinition represents data reduced by productions:

FunctionDefinition:
        DeclarationSpecifiers Declarator DeclarationListOpt FunctionBody
|       Declarator DeclarationListOpt FunctionBody                        // Case 1
Example
fmt.Println(exampleAST(252, "\U00100002 auto a { }"))
Output:

&cc.FunctionDefinition{
· DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · Case: 3,
· · · Token: example252.c:1:2: AUTO "auto",
· · },
· },
· Declarator: &cc.Declarator{
· · Linkage: None,
· · Type: auto int,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example252.c:1:7: IDENTIFIER "a",
· · },
· },
· FunctionBody: &cc.FunctionBody{
· · CompoundStatement: &cc.CompoundStatement{
· · · Token: example252.c:1:9: '{',
· · · Token2: example252.c:1:11: '}',
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(255, "\U00100002 a { }"))
Output:

&cc.FunctionDefinition{
· Case: 1,
· Declarator: &cc.Declarator{
· · Linkage: External,
· · Type: int,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example255.c:1:2: IDENTIFIER "a",
· · },
· },
· FunctionBody: &cc.FunctionBody{
· · CompoundStatement: &cc.CompoundStatement{
· · · Token: example255.c:1:4: '{',
· · · Token2: example255.c:1:6: '}',
· · },
· },
}

func (*FunctionDefinition) Pos

func (n *FunctionDefinition) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*FunctionDefinition) String

func (n *FunctionDefinition) String() string

String implements fmt.Stringer.

type FunctionSpecifier

type FunctionSpecifier struct {
	Case  int
	Token xc.Token
	// contains filtered or unexported fields
}

FunctionSpecifier represents data reduced by productions:

FunctionSpecifier:
        "inline"
|       "_Noreturn"  // Case 1
Example
fmt.Println(exampleAST(147, "\U00100002 inline ("))
Output:

&cc.FunctionSpecifier{
· Token: example147.c:1:2: INLINE "inline",
}
Example (Case1)
fmt.Println(exampleAST(148, "\U00100002 _Noreturn ("))
Output:

&cc.FunctionSpecifier{
· Case: 1,
· Token: example148.c:1:2: NORETURN "_Noreturn",
}

func (*FunctionSpecifier) Pos

func (n *FunctionSpecifier) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*FunctionSpecifier) String

func (n *FunctionSpecifier) String() string

String implements fmt.Stringer.

type GroupList

type GroupList struct {
	Case      int
	GroupList *GroupList
	GroupPart Node
}

GroupList represents data reduced by productions:

GroupList:
        GroupPart
|       GroupList GroupPart  // Case 1
Example
fmt.Println(exampleAST(286, "\U00100000 "))
Output:

&cc.GroupList{
}
Example (Case1)
fmt.Println(exampleAST(287, "\U00100000int\nf() {}"))
Output:

&cc.GroupList{
· GroupList: &cc.GroupList{
· · Case: 1,
· · GroupPart: []xc.Token{ // len 6
· · · 0: example287.c:2:1: IDENTIFIER "f",
· · · 1: example287.c:2:2: '(',
· · · 2: example287.c:2:3: ')',
· · · 3: example287.c:2:4: ' ',
· · · 4: example287.c:2:5: '{',
· · · 5: example287.c:2:6: '}',
· · },
· },
· GroupPart: []xc.Token{ // len 2
· · 0: example287.c:1:1: IDENTIFIER "int",
· · 1: example287.c:1:4: ' ',
· },
}

func (*GroupList) Pos

func (n *GroupList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*GroupList) String

func (n *GroupList) String() string

String implements fmt.Stringer.

type GroupListOpt

type GroupListOpt struct {
	GroupList *GroupList
}

GroupListOpt represents data reduced by productions:

GroupListOpt:
        /* empty */
|       GroupList    // Case 1
Example
fmt.Println(exampleAST(288, "\U00100000 \n#ifndef a  \n#elif") == (*GroupListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(289, "\U00100000 \n#ifndef a\nb\n#elif"))
Output:

&cc.GroupListOpt{
· GroupList: &cc.GroupList{
· · GroupPart: []xc.Token{ // len 2
· · · 0: example289.c:3:1: IDENTIFIER "b",
· · · 1: example289.c:3:2: ' ',
· · },
· },
}

func (*GroupListOpt) Pos

func (n *GroupListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*GroupListOpt) String

func (n *GroupListOpt) String() string

String implements fmt.Stringer.

type IdentifierList

type IdentifierList struct {
	Case           int
	IdentifierList *IdentifierList
	Token          xc.Token
	Token2         xc.Token
}

IdentifierList represents data reduced by productions:

IdentifierList:
        IDENTIFIER
|       IdentifierList ',' IDENTIFIER  // Case 1
Example
fmt.Println(exampleAST(177, "\U00100002 a ( b )"))
Output:

&cc.IdentifierList{
· Token: example177.c:1:6: IDENTIFIER "b",
}
Example (Case1)
fmt.Println(exampleAST(178, "\U00100002 a ( b , c )"))
Output:

&cc.IdentifierList{
· IdentifierList: &cc.IdentifierList{
· · Case: 1,
· · Token: example178.c:1:8: ',',
· · Token2: example178.c:1:10: IDENTIFIER "c",
· },
· Token: example178.c:1:6: IDENTIFIER "b",
}

func (*IdentifierList) Pos

func (n *IdentifierList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*IdentifierList) String

func (n *IdentifierList) String() string

String implements fmt.Stringer.

type IdentifierListOpt

type IdentifierListOpt struct {
	IdentifierList *IdentifierList
	// contains filtered or unexported fields
}

IdentifierListOpt represents data reduced by productions:

IdentifierListOpt:
        /* empty */
|       IdentifierList  // Case 1
Example
fmt.Println(exampleAST(179, "\U00100002 a ( )") == (*IdentifierListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(180, "\U00100002 a ( b )"))
Output:

&cc.IdentifierListOpt{
· IdentifierList: &cc.IdentifierList{
· · Token: example180.c:1:6: IDENTIFIER "b",
· },
}

func (*IdentifierListOpt) Pos

func (n *IdentifierListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*IdentifierListOpt) String

func (n *IdentifierListOpt) String() string

String implements fmt.Stringer.

type IdentifierOpt

type IdentifierOpt struct {
	Token xc.Token
}

IdentifierOpt represents data reduced by productions:

IdentifierOpt:
        /* empty */
|       IDENTIFIER   // Case 1
Example
fmt.Println(exampleAST(181, "\U00100002 struct {") == (*IdentifierOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(182, "\U00100002 enum a {"))
Output:

&cc.IdentifierOpt{
· Token: example182.c:1:7: IDENTIFIER "a",
}

func (*IdentifierOpt) Pos

func (n *IdentifierOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*IdentifierOpt) String

func (n *IdentifierOpt) String() string

String implements fmt.Stringer.

type IfGroup

type IfGroup struct {
	Case         int
	GroupListOpt *GroupListOpt
	PPTokenList  PPTokenList
	Token        xc.Token
	Token2       xc.Token
	Token3       xc.Token
}

IfGroup represents data reduced by productions:

IfGroup:
        PPIF PPTokenList '\n' GroupListOpt
|       PPIFDEF IDENTIFIER '\n' GroupListOpt   // Case 1
|       PPIFNDEF IDENTIFIER '\n' GroupListOpt  // Case 2
Example
fmt.Println(exampleAST(295, "\U00100000 \n#if other_a  \n#elif"))
Output:

&cc.IfGroup{
· PPTokenList: []xc.Token{ // len 4
· · 0: example295.c:2:4: ' ',
· · 1: example295.c:2:5: IDENTIFIER "other_a",
· · 2: example295.c:2:12: ' ',
· · 3: example295.c:2:14: ' ',
· },
· Token: example295.c:2:2: PPIF,
· Token2: example295.c:2:14: '\n',
}
Example (Case1)
fmt.Println(exampleAST(296, "\U00100000 \n#ifdef a  \n#elif"))
Output:

&cc.IfGroup{
· Case: 1,
· Token: example296.c:2:2: PPIFDEF,
· Token2: example296.c:2:8: IDENTIFIER "a",
· Token3: example296.c:2:11: '\n',
}
Example (Case2)
fmt.Println(exampleAST(297, "\U00100000 \n#ifndef a  \n#elif"))
Output:

&cc.IfGroup{
· Case: 2,
· Token: example297.c:2:2: PPIFNDEF,
· Token2: example297.c:2:9: IDENTIFIER "a",
· Token3: example297.c:2:12: '\n',
}

func (*IfGroup) Pos

func (n *IfGroup) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*IfGroup) String

func (n *IfGroup) String() string

String implements fmt.Stringer.

type IfSection

type IfSection struct {
	ElifGroupListOpt *ElifGroupListOpt
	ElseGroupOpt     *ElseGroupOpt
	EndifLine        *EndifLine
	IfGroup          *IfGroup
}

IfSection represents data reduced by production:

IfSection:
        IfGroup ElifGroupListOpt ElseGroupOpt EndifLine
Example
fmt.Println(exampleAST(294, "\U00100000 \n#if other_a  \n#endif"))
Output:

&cc.IfSection{
· EndifLine: &cc.EndifLine{
· · Token: example294.c:3:2: PPENDIF,
· },
· IfGroup: &cc.IfGroup{
· · PPTokenList: []xc.Token{ // len 4
· · · 0: example294.c:2:4: ' ',
· · · 1: example294.c:2:5: IDENTIFIER "other_a",
· · · 2: example294.c:2:12: ' ',
· · · 3: example294.c:2:14: ' ',
· · },
· · Token: example294.c:2:2: PPIF,
· · Token2: example294.c:2:14: '\n',
· },
}

func (*IfSection) Pos

func (n *IfSection) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*IfSection) String

func (n *IfSection) String() string

String implements fmt.Stringer.

type InitDeclarator

type InitDeclarator struct {
	Case        int
	Declarator  *Declarator
	Initializer *Initializer
	Token       xc.Token
}

InitDeclarator represents data reduced by productions:

InitDeclarator:
        Declarator
|       Declarator '=' Initializer  // Case 1
Example
fmt.Println(exampleAST(92, "\U00100002 a auto b ,"))
Output:

&cc.InitDeclarator{
· Declarator: &cc.Declarator{
· · Linkage: None,
· · Type: auto undefined,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example92.c:1:9: IDENTIFIER "b",
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(94, "\U00100002 auto a = 'b' ,"))
Output:

&cc.InitDeclarator{
· Case: 1,
· Declarator: &cc.Declarator{
· · Linkage: None,
· · Type: auto undefined,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example94.c:1:7: IDENTIFIER "a",
· · },
· },
· Initializer: &cc.Initializer{
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 98,
· · · Case: 1,
· · · Token: example94.c:1:11: CHARCONST "'b'",
· · },
· },
· Token: example94.c:1:9: '=',
}

func (*InitDeclarator) Pos

func (n *InitDeclarator) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*InitDeclarator) String

func (n *InitDeclarator) String() string

String implements fmt.Stringer.

type InitDeclaratorList

type InitDeclaratorList struct {
	Case               int
	InitDeclarator     *InitDeclarator
	InitDeclaratorList *InitDeclaratorList
	Token              xc.Token
}

InitDeclaratorList represents data reduced by productions:

InitDeclaratorList:
        InitDeclarator
|       InitDeclaratorList ',' InitDeclarator  // Case 1
Example
fmt.Println(exampleAST(88, "\U00100002 auto a ,"))
Output:

&cc.InitDeclaratorList{
· InitDeclarator: &cc.InitDeclarator{
· · Declarator: &cc.Declarator{
· · · Linkage: None,
· · · Type: auto undefined,
· · · DirectDeclarator: &cc.DirectDeclarator{
· · · · Token: example88.c:1:7: IDENTIFIER "a",
· · · },
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(89, "\U00100002 auto a , b ,"))
Output:

&cc.InitDeclaratorList{
· InitDeclarator: &cc.InitDeclarator{
· · Declarator: &cc.Declarator{
· · · Linkage: None,
· · · Type: auto undefined,
· · · DirectDeclarator: &cc.DirectDeclarator{
· · · · Token: example89.c:1:7: IDENTIFIER "a",
· · · },
· · },
· },
· InitDeclaratorList: &cc.InitDeclaratorList{
· · Case: 1,
· · InitDeclarator: &cc.InitDeclarator{
· · · Declarator: &cc.Declarator{
· · · · Linkage: None,
· · · · Type: auto undefined,
· · · · DirectDeclarator: &cc.DirectDeclarator{
· · · · · Token: example89.c:1:11: IDENTIFIER "b",
· · · · },
· · · },
· · },
· · Token: example89.c:1:9: ',',
· },
}

func (*InitDeclaratorList) Pos

func (n *InitDeclaratorList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*InitDeclaratorList) String

func (n *InitDeclaratorList) String() string

String implements fmt.Stringer.

type InitDeclaratorListOpt

type InitDeclaratorListOpt struct {
	InitDeclaratorList *InitDeclaratorList
}

InitDeclaratorListOpt represents data reduced by productions:

InitDeclaratorListOpt:
        /* empty */
|       InitDeclaratorList  // Case 1
Example
fmt.Println(exampleAST(90, "\U00100002 auto ;") == (*InitDeclaratorListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(91, "\U00100002 auto a ;"))
Output:

&cc.InitDeclaratorListOpt{
· InitDeclaratorList: &cc.InitDeclaratorList{
· · InitDeclarator: &cc.InitDeclarator{
· · · Declarator: &cc.Declarator{
· · · · Linkage: None,
· · · · Type: auto undefined,
· · · · DirectDeclarator: &cc.DirectDeclarator{
· · · · · Token: example91.c:1:7: IDENTIFIER "a",
· · · · },
· · · },
· · },
· },
}

func (*InitDeclaratorListOpt) Pos

func (n *InitDeclaratorListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*InitDeclaratorListOpt) String

func (n *InitDeclaratorListOpt) String() string

String implements fmt.Stringer.

type Initializer

type Initializer struct {
	Case            int
	CommaOpt        *CommaOpt
	Expression      *Expression
	Initializer     *Initializer
	InitializerList *InitializerList
	Token           xc.Token
	Token2          xc.Token
}

Initializer represents data reduced by productions:

Initializer:
        Expression
|       '{' InitializerList CommaOpt '}'  // Case 1
|       IDENTIFIER ':' Initializer        // Case 2
Example
fmt.Println(exampleAST(201, "\U00100002 auto a = 'b' ,"))
Output:

&cc.Initializer{
· Expression: &cc.Expression{
· · Type: int,
· · Value: 98,
· · Case: 1,
· · Token: example201.c:1:11: CHARCONST "'b'",
· },
}
Example (Case1)
fmt.Println(exampleAST(202, "\U00100002 auto a = { } ,"))
Output:

&cc.Initializer{
· Case: 1,
· Token: example202.c:1:11: '{',
· Token2: example202.c:1:13: '}',
}
Example (Case2)
fmt.Println(exampleAST(203, "\U00100002 auto a = b : 'c' ,"))
Output:

&cc.Initializer{
· Case: 2,
· Initializer: &cc.Initializer{
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 99,
· · · Case: 1,
· · · Token: example203.c:1:15: CHARCONST "'c'",
· · },
· },
· Token: example203.c:1:11: IDENTIFIER "b",
· Token2: example203.c:1:13: ':',
}

func (*Initializer) Pos

func (n *Initializer) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Initializer) String

func (n *Initializer) String() string

String implements fmt.Stringer.

type InitializerList

type InitializerList struct {
	Case            int
	DesignationOpt  *DesignationOpt
	Initializer     *Initializer
	InitializerList *InitializerList
	Token           xc.Token
}

InitializerList represents data reduced by productions:

InitializerList:
        DesignationOpt Initializer
|       InitializerList ',' DesignationOpt Initializer  // Case 1
|       /* empty */                                     // Case 2
Example
fmt.Println(exampleAST(204, "\U00100002 auto a = { 'b' ,"))
Output:

&cc.InitializerList{
· Initializer: &cc.Initializer{
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 98,
· · · Case: 1,
· · · Token: example204.c:1:13: CHARCONST "'b'",
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(205, "\U00100002 auto a = { , 'b' ,"))
Output:

&cc.InitializerList{
· Case: 1,
· Initializer: &cc.Initializer{
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 98,
· · · Case: 1,
· · · Token: example205.c:1:15: CHARCONST "'b'",
· · },
· },
· Token: example205.c:1:13: ',',
}
Example (Case2)
fmt.Println(exampleAST(206, "\U00100002 auto a = { ,") == (*InitializerList)(nil))
Output:

true

func (*InitializerList) Len

func (n *InitializerList) Len() (r int)

Len returns the number of items in n.

func (*InitializerList) Pos

func (n *InitializerList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*InitializerList) String

func (n *InitializerList) String() string

String implements fmt.Stringer.

type IterationStatement

type IterationStatement struct {
	Case               int
	Declaration        *Declaration
	ExpressionList     *ExpressionList
	ExpressionListOpt  *ExpressionListOpt
	ExpressionListOpt2 *ExpressionListOpt
	ExpressionListOpt3 *ExpressionListOpt
	Statement          *Statement
	Token              xc.Token
	Token2             xc.Token
	Token3             xc.Token
	Token4             xc.Token
	Token5             xc.Token
}

IterationStatement represents data reduced by productions:

IterationStatement:
        "while" '(' ExpressionList ')' Statement
|       "do" Statement "while" '(' ExpressionList ')' ';'                                      // Case 1
|       "for" '(' ExpressionListOpt ';' ExpressionListOpt ';' ExpressionListOpt ')' Statement  // Case 2
|       "for" '(' Declaration ExpressionListOpt ';' ExpressionListOpt ')' Statement            // Case 3
Example
fmt.Println(exampleAST(236, "\U00100001 ( { while ( 'a' ) ; !"))
Output:

&cc.IterationStatement{
· ExpressionList: &cc.ExpressionList{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example236.c:1:14: CHARCONST "'a'",
· · },
· },
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example236.c:1:20: ';',
· · },
· },
· Token: example236.c:1:6: WHILE "while",
· Token2: example236.c:1:12: '(',
· Token3: example236.c:1:18: ')',
}
Example (Case1)
fmt.Println(exampleAST(237, "\U00100001 ( { do ; while ( 'a' ) ; !"))
Output:

&cc.IterationStatement{
· Case: 1,
· ExpressionList: &cc.ExpressionList{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example237.c:1:19: CHARCONST "'a'",
· · },
· },
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example237.c:1:9: ';',
· · },
· },
· Token: example237.c:1:6: DO "do",
· Token2: example237.c:1:11: WHILE "while",
· Token3: example237.c:1:17: '(',
· Token4: example237.c:1:23: ')',
· Token5: example237.c:1:25: ';',
}
Example (Case2)
fmt.Println(exampleAST(238, "\U00100001 ( { for ( ; ; ) ; !"))
Output:

&cc.IterationStatement{
· Case: 2,
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example238.c:1:18: ';',
· · },
· },
· Token: example238.c:1:6: FOR "for",
· Token2: example238.c:1:10: '(',
· Token3: example238.c:1:12: ';',
· Token4: example238.c:1:14: ';',
· Token5: example238.c:1:16: ')',
}
Example (Case3)
fmt.Println(exampleAST(239, "\U00100001 ( { for ( auto ; ; ) ; !"))
Output:

&cc.IterationStatement{
· Case: 3,
· Declaration: &cc.Declaration{
· · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · Case: 3,
· · · · Token: example239.c:1:12: AUTO "auto",
· · · },
· · },
· · Token: example239.c:1:17: ';',
· },
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example239.c:1:23: ';',
· · },
· },
· Token: example239.c:1:6: FOR "for",
· Token2: example239.c:1:10: '(',
· Token3: example239.c:1:19: ';',
· Token4: example239.c:1:21: ')',
}

func (*IterationStatement) Pos

func (n *IterationStatement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*IterationStatement) String

func (n *IterationStatement) String() string

String implements fmt.Stringer.

type JumpStatement

type JumpStatement struct {
	Case              int
	Expression        *Expression
	ExpressionListOpt *ExpressionListOpt
	Token             xc.Token
	Token2            xc.Token
	Token3            xc.Token
}

JumpStatement represents data reduced by productions:

JumpStatement:
        "goto" IDENTIFIER ';'
|       "continue" ';'                  // Case 1
|       "break" ';'                     // Case 2
|       "return" ExpressionListOpt ';'  // Case 3
|       "goto" Expression ';'           // Case 4
Example
fmt.Println(exampleAST(240, "\U00100001 ( { goto a ; !"))
Output:

&cc.JumpStatement{
· Token: example240.c:1:6: GOTO "goto",
· Token2: example240.c:1:11: IDENTIFIER "a",
· Token3: example240.c:1:13: ';',
}
Example (Case1)
fmt.Println(exampleAST(241, "\U00100001 ( { continue ; !"))
Output:

&cc.JumpStatement{
· Case: 1,
· Token: example241.c:1:6: CONTINUE "continue",
· Token2: example241.c:1:15: ';',
}
Example (Case2)
fmt.Println(exampleAST(242, "\U00100001 ( { break ; !"))
Output:

&cc.JumpStatement{
· Case: 2,
· Token: example242.c:1:6: BREAK "break",
· Token2: example242.c:1:12: ';',
}
Example (Case3)
fmt.Println(exampleAST(243, "\U00100001 ( { return ; !"))
Output:

&cc.JumpStatement{
· Case: 3,
· Token: example243.c:1:6: RETURN "return",
· Token2: example243.c:1:13: ';',
}
Example (Case4)
fmt.Println(exampleAST(244, "\U00100001 ( { goto 'a' ; !"))
Output:

&cc.JumpStatement{
· Case: 4,
· Expression: &cc.Expression{
· · Type: int,
· · Value: 97,
· · Case: 1,
· · Token: example244.c:1:11: CHARCONST "'a'",
· },
· Token: example244.c:1:6: GOTO "goto",
· Token2: example244.c:1:15: ';',
}

func (*JumpStatement) Pos

func (n *JumpStatement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*JumpStatement) String

func (n *JumpStatement) String() string

String implements fmt.Stringer.

type Kind

type Kind int

Kind is a type category. Kind formally implements Type the only method returning a non nil value is Kind.

const (
	Undefined Kind = iota
	Void
	Ptr
	UintPtr // Type used for pointer arithmetic.
	Char
	SChar
	UChar
	Short
	UShort
	Int
	UInt
	Long
	ULong
	LongLong
	ULongLong
	Float
	Double
	LongDouble
	Bool
	FloatComplex
	DoubleComplex
	LongDoubleComplex
	Struct
	Union
	Enum
	TypedefName
	Function
	Array
)

Values of type Kind.

func (Kind) CString

func (k Kind) CString() string

func (Kind) String

func (i Kind) String() string

type LabeledStatement

type LabeledStatement struct {
	Case               int
	ConstantExpression *ConstantExpression
	Statement          *Statement
	Token              xc.Token
	Token2             xc.Token
}

LabeledStatement represents data reduced by productions:

LabeledStatement:
        IDENTIFIER ':' Statement
|       "case" ConstantExpression ':' Statement  // Case 1
|       "default" ':' Statement                  // Case 2
Example
fmt.Println(exampleAST(221, "\U00100001 ( { a : ; !"))
Output:

&cc.LabeledStatement{
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example221.c:1:10: ';',
· · },
· },
· Token: example221.c:1:6: IDENTIFIER "a",
· Token2: example221.c:1:8: ':',
}
Example (Case1)
fmt.Println(exampleAST(222, "\U00100001 ( { case 'a' : ; !"))
Output:

&cc.LabeledStatement{
· Case: 1,
· ConstantExpression: &cc.ConstantExpression{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example222.c:1:11: CHARCONST "'a'",
· · },
· },
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example222.c:1:17: ';',
· · },
· },
· Token: example222.c:1:6: CASE "case",
· Token2: example222.c:1:15: ':',
}
Example (Case2)
fmt.Println(exampleAST(223, "\U00100001 ( { default : ; !"))
Output:

&cc.LabeledStatement{
· Case: 2,
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example223.c:1:16: ';',
· · },
· },
· Token: example223.c:1:6: DEFAULT "default",
· Token2: example223.c:1:14: ':',
}

func (*LabeledStatement) Pos

func (n *LabeledStatement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*LabeledStatement) String

func (n *LabeledStatement) String() string

String implements fmt.Stringer.

type Linkage

type Linkage int

Linkage is a C linkage kind ([0], 6.2.2, p. 30)

const (
	None Linkage = iota
	Internal
	External
)

Values of type Linkage.

func (Linkage) String

func (i Linkage) String() string

type LongStringLitID

type LongStringLitID int

LongStringLitID is the type of an Expression.Value representing the numeric ID of a long string literal.

type Macro

type Macro struct {
	Args     []int       // Numeric IDs of argument identifiers.
	DefTok   xc.Token    // Macro name definition token.
	IsFnLike bool        // Whether the macro is function like.
	Type     Type        // Non nil if macro expands to a constant expression.
	Value    interface{} // Non nil if macro expands to a constant expression.
	// contains filtered or unexported fields
}

Macro represents a C preprocessor macro.

func (*Macro) ReplacementToks

func (m *Macro) ReplacementToks() (r []xc.Token)

ReplacementToks returns the tokens that replace m.

type Member

type Member struct {
	BitFieldType  Type
	BitFieldGroup int         // Ordinal number of the packed bits field.
	BitOffsetOf   int         // Bit field starting bit.
	Bits          int         // Size in bits for bit fields, 0 otherwise.
	Declarator    *Declarator // Possibly nil for bit fields.
	Name          int
	OffsetOf      int
	Padding       int // Number of unused bytes added to the end of the field to force proper alignment requirements.
	Type          Type
}

Member describes a member of a struct or union.

BitFieldGroup represents the ordinal number of the packed bit fields:

struct foo {
	int i;
	int j:1;	// BitFieldGroup: 0
	int k:2;	// BitFieldGroup: 0
	double l;
	int m:1;	// BitFieldGroup: 1
	int n:2;	// BitFieldGroup: 1
}

type Model

type Model struct {
	Items map[Kind]ModelItem

	BoolType              Type
	CharType              Type
	DoubleComplexType     Type
	DoubleType            Type
	FloatComplexType      Type
	FloatType             Type
	IntType               Type
	LongDoubleComplexType Type
	LongDoubleType        Type
	LongLongType          Type
	LongType              Type
	ShortType             Type
	UCharType             Type
	UIntType              Type
	ULongLongType         Type
	ULongType             Type
	UShortType            Type
	UintPtrType           Type
	VoidType              Type

	Signed [kindMax]bool // Signed[Kind] reports whether Kind is a signed integer type.
	// contains filtered or unexported fields
}

Model describes size and align requirements of predeclared types.

func (*Model) BinOpType

func (m *Model) BinOpType(a, b Type) Type

BinOpType returns the evaluation type of a binop b, ie. the type operands are converted to before performing the operation. Operands must be arithmetic types.

See [0], 6.3.1.8 - Usual arithmetic conversions.

func (*Model) MustConvert

func (m *Model) MustConvert(v interface{}, typ Type) interface{}

MustConvert returns v converted to the type of typ. If the conversion is impossible, the method panics.

Conversion an integer type to any pointer type yields an uintptr.

type ModelItem

type ModelItem struct {
	Size        int         // Size of the entity in bytes.
	Align       int         // Alignment of the entity when it's not a struct field.
	StructAlign int         // Alignment of the entity when it's a struct field.
	More        interface{} // Optional user data.
}

ModelItem is a single item of a model.

Note about StructAlign: To provide GCC ABI compatibility set, for example, Align of Double to 8 and StructAlign of Double to 4.

type Namespace

type Namespace int

Namespace is a binding category.

const (
	NSIdentifiers Namespace = iota
	NSTags
)

Values of type Namespace.

func (Namespace) String

func (i Namespace) String() string

type Node

type Node interface {
	Pos() token.Pos
}

Node represents an AST node.

type Opt

type Opt func(*lexer)

Opt is a configuration/setup function that can be passed to the Parser function.

func AllowCompatibleTypedefRedefinitions

func AllowCompatibleTypedefRedefinitions() Opt

AllowCompatibleTypedefRedefinitions makes the parser accept compatible typedef redefinitions.

typedef int foo;
typedef int foo; // ok with this option.
typedef long int foo; // never ok.

func Cpp

func Cpp(f func([]xc.Token)) Opt

Cpp registers a preprocessor hook function which is called for every line, or group of lines the preprocessor produces before it is consumed by the parser. The token slice must not be modified by the hook.

func CrashOnError

func CrashOnError() Opt

CrashOnError is an debugging option.

func EnableAlignOf

func EnableAlignOf() Opt

EnableAlignOf enables recognizing the reserved word _Alignof.

func EnableAlternateKeywords

func EnableAlternateKeywords() Opt

EnableAlternateKeywords makes the parser accept, for example, non standard

__asm__

as an equvalent of keyowrd asm (which first hast be permitted by EnableAsm).

func EnableAnonymousStructFields

func EnableAnonymousStructFields() Opt

EnableAnonymousStructFields makes the parser accept non standard

struct {
	int i;
	struct {
		int j;
	};
	int k;
};

func EnableAsm

func EnableAsm() Opt

EnableAsm enables recognizing the reserved word asm.

func EnableBuiltinClassifyType

func EnableBuiltinClassifyType() Opt

EnableBuiltinClassifyType makes the parser handle specially

__builtin_constant_p(expr)

See https://gcc.gnu.org/onlinedocs/gccint/Varargs.html

func EnableBuiltinConstantP

func EnableBuiltinConstantP() Opt

EnableBuiltinConstantP makes the parser handle specially

__builtin_constant_p(expr)

See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

func EnableComputedGotos

func EnableComputedGotos() Opt

EnableComputedGotos makes the parser accept non standard

variable = &&label;
goto *variable;

See https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Labels-as-Values.html

func EnableDefineOmitCommaBeforeDDD

func EnableDefineOmitCommaBeforeDDD() Opt

EnableDefineOmitCommaBeforeDDD makes the parser accept non standard

#define foo(a, b...) // Note the missing comma after identifier list.

func EnableDlrInIdentifiers

func EnableDlrInIdentifiers() Opt

EnableDlrInIdentifiers makes the parser accept non standard

int foo$bar

func EnableEmptyDeclarations

func EnableEmptyDeclarations() Opt

EnableEmptyDeclarations makes the parser accept non standard

; // C++11 empty declaration

func EnableEmptyDefine

func EnableEmptyDefine() Opt

EnableEmptyDefine makes the parser accept non standard

#define

func EnableEmptyStructs

func EnableEmptyStructs() Opt

EnableEmptyStructs makes the parser accept non standard

struct foo {};

func EnableImaginarySuffix

func EnableImaginarySuffix() Opt

EnableImaginarySuffix makes the parser accept non standard

4.2i, 5.6j etc

See https://gcc.gnu.org/onlinedocs/gcc/Complex.html

func EnableImplicitFuncDef

func EnableImplicitFuncDef() Opt

EnableImplicitFuncDef makes the parser accept non standard

int f() {
	return g(); // g is undefined, but assumed to be returning int.
}

func EnableImplicitIntType

func EnableImplicitIntType() Opt

EnableImplicitIntType makes the parser accept non standard omitting type specifier. For example

static i;

becomes the same as

static int i;

func EnableIncludeNext

func EnableIncludeNext() Opt

EnableIncludeNext makes the parser accept non standard

#include_next "foo.h"

func EnableLegacyDesignators

func EnableLegacyDesignators() Opt

EnableLegacyDesignators makes the parser accept legacy designators

{ a: 42 } // Obsolete since GCC 2.5, standard is { .a=42 }

See https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html

func EnableNonConstStaticInitExpressions

func EnableNonConstStaticInitExpressions() Opt

EnableNonConstStaticInitExpressions makes the parser accept non standard

static int i = f();

[0], 6.7.8/4: All the expressions in an initializer for an object that has static storage duration shall be constant expressions or string literals.

func EnableNoreturn

func EnableNoreturn() Opt

EnableNoreturn enables recognizing the reserved word _Noreturn.

func EnableOmitConditionalOperand

func EnableOmitConditionalOperand() Opt

EnableOmitConditionalOperand makes the parser accept non standard

x ? : y

See https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Conditionals.html#Conditionals

func EnableOmitFuncArgTypes

func EnableOmitFuncArgTypes() Opt

EnableOmitFuncArgTypes makes the parser accept non standard

f(a) // Same as int f(int a).

func EnableOmitFuncRetType

func EnableOmitFuncRetType() Opt

EnableOmitFuncRetType makes the parser accept non standard

f() // Same as int f().

func EnableParenthesizedCompoundStatemen

func EnableParenthesizedCompoundStatemen() Opt

EnableParenthesizedCompoundStatemen makes the parser accept non standard

({ ... })

as an expression. See [3].

func EnableStaticAssert

func EnableStaticAssert() Opt

EnableStaticAssert enables recognizing the reserved word _Static_assert.

func EnableTypeOf

func EnableTypeOf() Opt

EnableTypeOf enables recognizing the reserved word typeof.

func EnableUndefExtraTokens

func EnableUndefExtraTokens() Opt

EnableUndefExtraTokens makes the parser accept non standard

#undef foo(bar)

func EnableUnsignedEnums

func EnableUnsignedEnums() Opt

EnableUnsignedEnums makes the parser handle choose unsigned int as the type of an enumeration with no negative members.

func EnableWideBitFieldTypes

func EnableWideBitFieldTypes() Opt

EnableWideBitFieldTypes makes the parser accept non standard bitfield types (i.e, long long and unsigned long long).

unsigned long long bits : 2;

func EnableWideEnumValues

func EnableWideEnumValues() Opt

EnableWideEnumValues makes the parser accept non standard

enum { v = X }; for X wider than 32 bits.

func ErrLimit

func ErrLimit(n int) Opt

ErrLimit limits the number of calls to the error reporting methods. After the limit is reached, all errors are reported using log.Print and then log.Fatal() is called with a message about too many errors. To disable error limit, set ErrLimit to value less or equal zero. Default value is 10.

func IncludePaths

func IncludePaths(paths []string) Opt

IncludePaths option configures where to search for include files (eg. "name.h"). Multiple IncludePaths options may be used, the resulting search path list is produced by appending the option arguments in order of appearance.

func KeepComments

func KeepComments() Opt

KeepComments makes the parser keep comments.

func Mode99c

func Mode99c() Opt

Mode99c turns on support for the 99c compiler.

func SysIncludePaths

func SysIncludePaths(paths []string) Opt

SysIncludePaths option configures where to search for system include files (eg. <name.h>). Multiple SysIncludePaths options may be used, the resulting search path list is produced by appending the option arguments in order of appearance.

func Trigraphs

func Trigraphs() Opt

Trigraphs enables processing of trigraphs.

func YyDebug

func YyDebug(n int) Opt

YyDebug sets the parser debug level.

type PPTokenList

type PPTokenList int

PPTokenList represents a sequence of tokens.

func (PPTokenList) Pos

func (p PPTokenList) Pos() token.Pos

type Parameter

type Parameter struct {
	Declarator *Declarator
	Name       int
	Type       Type
}

Parameter describes a function argument.

type ParameterDeclaration

type ParameterDeclaration struct {
	AbstractDeclaratorOpt *AbstractDeclaratorOpt
	Case                  int
	DeclarationSpecifiers *DeclarationSpecifiers
	Declarator            *Declarator
	// contains filtered or unexported fields
}

ParameterDeclaration represents data reduced by productions:

ParameterDeclaration:
        DeclarationSpecifiers Declarator
|       DeclarationSpecifiers AbstractDeclaratorOpt  // Case 1
Example
fmt.Println(exampleAST(175, "\U00100002 a ( auto b )"))
Output:

&cc.ParameterDeclaration{
· DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · Case: 3,
· · · Token: example175.c:1:6: AUTO "auto",
· · },
· },
· Declarator: &cc.Declarator{
· · Linkage: None,
· · Type: auto undefined,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example175.c:1:11: IDENTIFIER "b",
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(176, "\U00100002 a ( auto )"))
Output:

&cc.ParameterDeclaration{
· Case: 1,
· DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · Case: 3,
· · · Token: example176.c:1:6: AUTO "auto",
· · },
· },
}

func (*ParameterDeclaration) Pos

func (n *ParameterDeclaration) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ParameterDeclaration) String

func (n *ParameterDeclaration) String() string

String implements fmt.Stringer.

type ParameterList

type ParameterList struct {
	Case                 int
	ParameterDeclaration *ParameterDeclaration
	ParameterList        *ParameterList
	Token                xc.Token
}

ParameterList represents data reduced by productions:

ParameterList:
        ParameterDeclaration
|       ParameterList ',' ParameterDeclaration  // Case 1
Example
fmt.Println(exampleAST(173, "\U00100002 a ( auto )"))
Output:

&cc.ParameterList{
· ParameterDeclaration: &cc.ParameterDeclaration{
· · Case: 1,
· · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · Case: 3,
· · · · Token: example173.c:1:6: AUTO "auto",
· · · },
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(174, "\U00100002 a ( auto , auto )"))
Output:

&cc.ParameterList{
· ParameterDeclaration: &cc.ParameterDeclaration{
· · Case: 1,
· · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · Case: 3,
· · · · Token: example174.c:1:6: AUTO "auto",
· · · },
· · },
· },
· ParameterList: &cc.ParameterList{
· · Case: 1,
· · ParameterDeclaration: &cc.ParameterDeclaration{
· · · Case: 1,
· · · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · · Case: 3,
· · · · · Token: example174.c:1:13: AUTO "auto",
· · · · },
· · · },
· · },
· · Token: example174.c:1:11: ',',
· },
}

func (*ParameterList) Pos

func (n *ParameterList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ParameterList) String

func (n *ParameterList) String() string

String implements fmt.Stringer.

type ParameterTypeList

type ParameterTypeList struct {
	Case          int
	ParameterList *ParameterList
	Token         xc.Token
	Token2        xc.Token
	// contains filtered or unexported fields
}

ParameterTypeList represents data reduced by productions:

ParameterTypeList:
        ParameterList
|       ParameterList ',' "..."  // Case 1
Example
fmt.Println(exampleAST(169, "\U00100002 a ( auto )"))
Output:

&cc.ParameterTypeList{
· ParameterList: &cc.ParameterList{
· · ParameterDeclaration: &cc.ParameterDeclaration{
· · · Case: 1,
· · · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · · Case: 3,
· · · · · Token: example169.c:1:6: AUTO "auto",
· · · · },
· · · },
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(170, "\U00100002 a ( auto , ... )"))
Output:

&cc.ParameterTypeList{
· Case: 1,
· ParameterList: &cc.ParameterList{
· · ParameterDeclaration: &cc.ParameterDeclaration{
· · · Case: 1,
· · · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · · Case: 3,
· · · · · Token: example170.c:1:6: AUTO "auto",
· · · · },
· · · },
· · },
· },
· Token: example170.c:1:11: ',',
· Token2: example170.c:1:13: DDD,
}

func (*ParameterTypeList) Pos

func (n *ParameterTypeList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ParameterTypeList) String

func (n *ParameterTypeList) String() string

String implements fmt.Stringer.

type ParameterTypeListOpt

type ParameterTypeListOpt struct {
	ParameterTypeList *ParameterTypeList
}

ParameterTypeListOpt represents data reduced by productions:

ParameterTypeListOpt:
        /* empty */
|       ParameterTypeList  // Case 1
Example
fmt.Println(exampleAST(171, "\U00100001 ( _Bool ( )") == (*ParameterTypeListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(172, "\U00100001 ( _Bool ( auto )"))
Output:

&cc.ParameterTypeListOpt{
· ParameterTypeList: &cc.ParameterTypeList{
· · ParameterList: &cc.ParameterList{
· · · ParameterDeclaration: &cc.ParameterDeclaration{
· · · · Case: 1,
· · · · DeclarationSpecifiers: &cc.DeclarationSpecifiers{
· · · · · StorageClassSpecifier: &cc.StorageClassSpecifier{
· · · · · · Case: 3,
· · · · · · Token: example172.c:1:12: AUTO "auto",
· · · · · },
· · · · },
· · · },
· · },
· },
}

func (*ParameterTypeListOpt) Pos

func (n *ParameterTypeListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*ParameterTypeListOpt) String

func (n *ParameterTypeListOpt) String() string

String implements fmt.Stringer.

type Pointer

type Pointer struct {
	Case                 int
	Pointer              *Pointer
	Token                xc.Token
	TypeQualifierListOpt *TypeQualifierListOpt
}

Pointer represents data reduced by productions:

Pointer:
        '*' TypeQualifierListOpt
|       '*' TypeQualifierListOpt Pointer  // Case 1
Example
fmt.Println(exampleAST(161, "\U00100002 * ("))
Output:

&cc.Pointer{
· Token: example161.c:1:2: '*',
}
Example (Case1)
fmt.Println(exampleAST(162, "\U00100002 * * ("))
Output:

&cc.Pointer{
· Case: 1,
· Pointer: &cc.Pointer{
· · Token: example162.c:1:4: '*',
· },
· Token: example162.c:1:2: '*',
}

func (*Pointer) Pos

func (n *Pointer) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Pointer) String

func (n *Pointer) String() string

String implements fmt.Stringer.

type PointerOpt

type PointerOpt struct {
	Pointer *Pointer
}

PointerOpt represents data reduced by productions:

PointerOpt:
        /* empty */
|       Pointer      // Case 1
Example
fmt.Println(exampleAST(163, "\U00100002 auto (") == (*PointerOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(164, "\U00100001 ( _Bool * ("))
Output:

&cc.PointerOpt{
· Pointer: &cc.Pointer{
· · Token: example164.c:1:10: '*',
· },
}

func (*PointerOpt) Pos

func (n *PointerOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*PointerOpt) String

func (n *PointerOpt) String() string

String implements fmt.Stringer.

type PreprocessingFile

type PreprocessingFile struct {
	GroupList *GroupList
	// contains filtered or unexported fields
}

PreprocessingFile represents data reduced by production:

PreprocessingFile:
        GroupList
Example
fmt.Println(exampleAST(285, "\U00100000 "))
Output:

&cc.PreprocessingFile{
· GroupList: &cc.GroupList{
· },
}

func (*PreprocessingFile) Pos

func (n *PreprocessingFile) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*PreprocessingFile) String

func (n *PreprocessingFile) String() string

String implements fmt.Stringer.

type Scope

type Scope int

Scope is a bindings category.

const (
	ScopeFile Scope = iota
	ScopeBlock
	ScopeMembers
	ScopeParams
)

Values of type Scope

func (Scope) String

func (i Scope) String() string

type SelectionStatement

type SelectionStatement struct {
	Case           int
	ExpressionList *ExpressionList
	Statement      *Statement
	Statement2     *Statement
	Token          xc.Token
	Token2         xc.Token
	Token3         xc.Token
	Token4         xc.Token
}

SelectionStatement represents data reduced by productions:

SelectionStatement:
        "if" '(' ExpressionList ')' Statement
|       "if" '(' ExpressionList ')' Statement "else" Statement  // Case 1
|       "switch" '(' ExpressionList ')' Statement               // Case 2
Example
fmt.Println(exampleAST(233, "\U00100001 ( { if ( 'a' ) ; !"))
Output:

&cc.SelectionStatement{
· ExpressionList: &cc.ExpressionList{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example233.c:1:11: CHARCONST "'a'",
· · },
· },
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example233.c:1:17: ';',
· · },
· },
· Token: example233.c:1:6: IF "if",
· Token2: example233.c:1:9: '(',
· Token3: example233.c:1:15: ')',
}
Example (Case1)
fmt.Println(exampleAST(234, "\U00100001 ( { if ( 'a' ) ; else ; !"))
Output:

&cc.SelectionStatement{
· Case: 1,
· ExpressionList: &cc.ExpressionList{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example234.c:1:11: CHARCONST "'a'",
· · },
· },
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example234.c:1:17: ';',
· · },
· },
· Statement2: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example234.c:1:24: ';',
· · },
· },
· Token: example234.c:1:6: IF "if",
· Token2: example234.c:1:9: '(',
· Token3: example234.c:1:15: ')',
· Token4: example234.c:1:19: ELSE "else",
}
Example (Case2)
fmt.Println(exampleAST(235, "\U00100001 ( { switch ( 'a' ) ; !"))
Output:

&cc.SelectionStatement{
· Case: 2,
· ExpressionList: &cc.ExpressionList{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example235.c:1:15: CHARCONST "'a'",
· · },
· },
· Statement: &cc.Statement{
· · Case: 2,
· · ExpressionStatement: &cc.ExpressionStatement{
· · · Token: example235.c:1:21: ';',
· · },
· },
· Token: example235.c:1:6: SWITCH "switch",
· Token2: example235.c:1:13: '(',
· Token3: example235.c:1:19: ')',
}

func (*SelectionStatement) Pos

func (n *SelectionStatement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*SelectionStatement) String

func (n *SelectionStatement) String() string

String implements fmt.Stringer.

type Specifier

type Specifier interface {
	IsAuto() bool     // StorageClassSpecifier "auto" present.
	IsConst() bool    // TypeQualifier "const" present.
	IsExtern() bool   // StorageClassSpecifier "extern" present.
	IsInline() bool   // FunctionSpecifier "inline" present.
	IsRegister() bool // StorageClassSpecifier "register" present.
	IsRestrict() bool // TypeQualifier "restrict" present.
	IsStatic() bool   // StorageClassSpecifier "static" present.
	IsTypedef() bool  // StorageClassSpecifier "typedef" present.
	IsVolatile() bool // TypeQualifier "volatile" present.
	TypedefName() int // TypedefName returns the typedef name ID used, if any, zero otherwise.
	// contains filtered or unexported methods
}

Specifier describes a combination of {Function,StorageClass,Type}Specifiers and TypeQualifiers.

type SpecifierQualifierList

type SpecifierQualifierList struct {
	Case                      int
	SpecifierQualifierListOpt *SpecifierQualifierListOpt
	TypeQualifier             *TypeQualifier
	TypeSpecifier             *TypeSpecifier
	// contains filtered or unexported fields
}

SpecifierQualifierList represents data reduced by productions:

SpecifierQualifierList:
        TypeSpecifier SpecifierQualifierListOpt
|       TypeQualifier SpecifierQualifierListOpt  // Case 1
Example
fmt.Println(exampleAST(127, "\U00100001 ( _Bool ("))
Output:

&cc.SpecifierQualifierList{
· TypeSpecifier: &cc.TypeSpecifier{
· · Case: 9,
· · Token: example127.c:1:4: BOOL "_Bool",
· },
}
Example (Case1)
fmt.Println(exampleAST(128, "\U00100001 ( const ("))
Output:

&cc.SpecifierQualifierList{
· Case: 1,
· TypeQualifier: &cc.TypeQualifier{
· · Token: example128.c:1:4: CONST "const",
· },
}

func (*SpecifierQualifierList) IsAuto

func (n *SpecifierQualifierList) IsAuto() bool

IsAuto implements specifier.

func (*SpecifierQualifierList) IsConst

func (n *SpecifierQualifierList) IsConst() bool

IsConst returns whether n includes the 'const' type qualifier.

func (*SpecifierQualifierList) IsExtern

func (n *SpecifierQualifierList) IsExtern() bool

IsExtern implements specifier.

func (*SpecifierQualifierList) IsInline

func (n *SpecifierQualifierList) IsInline() bool

IsInline implements specifier.

func (*SpecifierQualifierList) IsRegister

func (n *SpecifierQualifierList) IsRegister() bool

IsRegister implements specifier.

func (*SpecifierQualifierList) IsRestrict

func (n *SpecifierQualifierList) IsRestrict() bool

IsRestrict implements specifier.

func (*SpecifierQualifierList) IsStatic

func (n *SpecifierQualifierList) IsStatic() bool

IsStatic implements specifier.

func (*SpecifierQualifierList) IsTypedef

func (n *SpecifierQualifierList) IsTypedef() bool

IsTypedef implements specifier.

func (*SpecifierQualifierList) IsVolatile

func (n *SpecifierQualifierList) IsVolatile() bool

IsVolatile implements specifier.

func (*SpecifierQualifierList) Pos

func (n *SpecifierQualifierList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*SpecifierQualifierList) String

func (n *SpecifierQualifierList) String() string

String implements fmt.Stringer.

func (*SpecifierQualifierList) TypedefName

func (n *SpecifierQualifierList) TypedefName() int

TypedefName implements Specifier.

type SpecifierQualifierListOpt

type SpecifierQualifierListOpt struct {
	SpecifierQualifierList *SpecifierQualifierList
	// contains filtered or unexported fields
}

SpecifierQualifierListOpt represents data reduced by productions:

SpecifierQualifierListOpt:
        /* empty */
|       SpecifierQualifierList  // Case 1
Example
fmt.Println(exampleAST(129, "\U00100001 ( _Bool (") == (*SpecifierQualifierListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(130, "\U00100001 ( _Bool _Bool ("))
Output:

&cc.SpecifierQualifierListOpt{
· SpecifierQualifierList: &cc.SpecifierQualifierList{
· · TypeSpecifier: &cc.TypeSpecifier{
· · · Case: 9,
· · · Token: example130.c:1:10: BOOL "_Bool",
· · },
· },
}

func (*SpecifierQualifierListOpt) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*SpecifierQualifierListOpt) String

func (n *SpecifierQualifierListOpt) String() string

String implements fmt.Stringer.

type Statement

type Statement struct {
	AssemblerStatement  *AssemblerStatement
	Case                int
	CompoundStatement   *CompoundStatement
	ExpressionStatement *ExpressionStatement
	IterationStatement  *IterationStatement
	JumpStatement       *JumpStatement
	LabeledStatement    *LabeledStatement
	SelectionStatement  *SelectionStatement
}

Statement represents data reduced by productions:

Statement:
        LabeledStatement
|       CompoundStatement    // Case 1
|       ExpressionStatement  // Case 2
|       SelectionStatement   // Case 3
|       IterationStatement   // Case 4
|       JumpStatement        // Case 5
|       AssemblerStatement   // Case 6
Example
fmt.Println(exampleAST(214, "\U00100001 ( { default : ; !"))
Output:

&cc.Statement{
· LabeledStatement: &cc.LabeledStatement{
· · Case: 2,
· · Statement: &cc.Statement{
· · · Case: 2,
· · · ExpressionStatement: &cc.ExpressionStatement{
· · · · Token: example214.c:1:16: ';',
· · · },
· · },
· · Token: example214.c:1:6: DEFAULT "default",
· · Token2: example214.c:1:14: ':',
· },
}
Example (Case1)
fmt.Println(exampleAST(215, "\U00100001 ( { { } !"))
Output:

&cc.Statement{
· Case: 1,
· CompoundStatement: &cc.CompoundStatement{
· · Token: example215.c:1:6: '{',
· · Token2: example215.c:1:8: '}',
· },
}
Example (Case2)
fmt.Println(exampleAST(216, "\U00100001 ( { ; !"))
Output:

&cc.Statement{
· Case: 2,
· ExpressionStatement: &cc.ExpressionStatement{
· · Token: example216.c:1:6: ';',
· },
}
Example (Case3)
fmt.Println(exampleAST(217, "\U00100001 ( { if ( 'a' ) ; !"))
Output:

&cc.Statement{
· Case: 3,
· SelectionStatement: &cc.SelectionStatement{
· · ExpressionList: &cc.ExpressionList{
· · · Type: int,
· · · Value: 97,
· · · Expression: &cc.Expression{
· · · · Type: int,
· · · · Value: 97,
· · · · Case: 1,
· · · · Token: example217.c:1:11: CHARCONST "'a'",
· · · },
· · },
· · Statement: &cc.Statement{
· · · Case: 2,
· · · ExpressionStatement: &cc.ExpressionStatement{
· · · · Token: example217.c:1:17: ';',
· · · },
· · },
· · Token: example217.c:1:6: IF "if",
· · Token2: example217.c:1:9: '(',
· · Token3: example217.c:1:15: ')',
· },
}
Example (Case4)
fmt.Println(exampleAST(218, "\U00100001 ( { while ( 'a' ) ; !"))
Output:

&cc.Statement{
· Case: 4,
· IterationStatement: &cc.IterationStatement{
· · ExpressionList: &cc.ExpressionList{
· · · Type: int,
· · · Value: 97,
· · · Expression: &cc.Expression{
· · · · Type: int,
· · · · Value: 97,
· · · · Case: 1,
· · · · Token: example218.c:1:14: CHARCONST "'a'",
· · · },
· · },
· · Statement: &cc.Statement{
· · · Case: 2,
· · · ExpressionStatement: &cc.ExpressionStatement{
· · · · Token: example218.c:1:20: ';',
· · · },
· · },
· · Token: example218.c:1:6: WHILE "while",
· · Token2: example218.c:1:12: '(',
· · Token3: example218.c:1:18: ')',
· },
}
Example (Case5)
fmt.Println(exampleAST(219, "\U00100001 ( { break ; !"))
Output:

&cc.Statement{
· Case: 5,
· JumpStatement: &cc.JumpStatement{
· · Case: 2,
· · Token: example219.c:1:6: BREAK "break",
· · Token2: example219.c:1:12: ';',
· },
}
Example (Case6)
fmt.Println(exampleAST(220, "\U00100001 ( { asm ( \"a\" ) !"))
Output:

&cc.Statement{
· AssemblerStatement: &cc.AssemblerStatement{
· · BasicAssemblerStatement: &cc.BasicAssemblerStatement{
· · · AssemblerInstructions: &cc.AssemblerInstructions{
· · · · Token: example220.c:1:12: STRINGLITERAL "\"a\"",
· · · },
· · · Token: example220.c:1:6: ASM "asm",
· · · Token2: example220.c:1:10: '(',
· · · Token3: example220.c:1:16: ')',
· · },
· },
· Case: 6,
}

func (*Statement) Pos

func (n *Statement) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*Statement) String

func (n *Statement) String() string

String implements fmt.Stringer.

type StaticAssertDeclaration

type StaticAssertDeclaration struct {
	ConstantExpression *ConstantExpression
	Token              xc.Token
	Token2             xc.Token
	Token3             xc.Token
	Token4             xc.Token
	Token5             xc.Token
	Token6             xc.Token
}

StaticAssertDeclaration represents data reduced by production:

StaticAssertDeclaration:
        "_Static_assert" '(' ConstantExpression ',' STRINGLITERAL ')' ';'
Example
fmt.Println(exampleAST(284, "\U00100002 _Static_assert ( 'a' , \"b\" ) ;"))
Output:

&cc.StaticAssertDeclaration{
· ConstantExpression: &cc.ConstantExpression{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example284.c:1:19: CHARCONST "'a'",
· · },
· },
· Token: example284.c:1:2: STATIC_ASSERT "_Static_assert",
· Token2: example284.c:1:17: '(',
· Token3: example284.c:1:23: ',',
· Token4: example284.c:1:25: STRINGLITERAL "\"b\"",
· Token5: example284.c:1:29: ')',
· Token6: example284.c:1:31: ';',
}

func (*StaticAssertDeclaration) Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StaticAssertDeclaration) String

func (n *StaticAssertDeclaration) String() string

String implements fmt.Stringer.

type StorageClassSpecifier

type StorageClassSpecifier struct {
	Case  int
	Token xc.Token
	// contains filtered or unexported fields
}

StorageClassSpecifier represents data reduced by productions:

StorageClassSpecifier:
        "typedef"
|       "extern"    // Case 1
|       "static"    // Case 2
|       "auto"      // Case 3
|       "register"  // Case 4
Example
fmt.Println(exampleAST(95, "\U00100002 typedef ("))
Output:

&cc.StorageClassSpecifier{
· Token: example95.c:1:2: TYPEDEF "typedef",
}
Example (Case1)
fmt.Println(exampleAST(96, "\U00100002 extern ("))
Output:

&cc.StorageClassSpecifier{
· Case: 1,
· Token: example96.c:1:2: EXTERN "extern",
}
Example (Case2)
fmt.Println(exampleAST(97, "\U00100002 static ("))
Output:

&cc.StorageClassSpecifier{
· Case: 2,
· Token: example97.c:1:2: STATIC "static",
}
Example (Case3)
fmt.Println(exampleAST(98, "\U00100002 auto ("))
Output:

&cc.StorageClassSpecifier{
· Case: 3,
· Token: example98.c:1:2: AUTO "auto",
}
Example (Case4)
fmt.Println(exampleAST(99, "\U00100002 register ("))
Output:

&cc.StorageClassSpecifier{
· Case: 4,
· Token: example99.c:1:2: REGISTER "register",
}

func (*StorageClassSpecifier) Pos

func (n *StorageClassSpecifier) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StorageClassSpecifier) String

func (n *StorageClassSpecifier) String() string

String implements fmt.Stringer.

type StringLitID

type StringLitID int

StringLitID is the type of an Expression.Value representing the numeric ID of a string literal.

type StructDeclaration

type StructDeclaration struct {
	Case                    int
	SpecifierQualifierList  *SpecifierQualifierList
	StaticAssertDeclaration *StaticAssertDeclaration
	StructDeclaratorList    *StructDeclaratorList
	Token                   xc.Token
}

StructDeclaration represents data reduced by productions:

StructDeclaration:
        SpecifierQualifierList StructDeclaratorList ';'
|       SpecifierQualifierList ';'                       // Case 1
|       StaticAssertDeclaration                          // Case 2
Example
fmt.Println(exampleAST(124, "\U00100002 struct { _Bool a ; }"))
Output:

&cc.StructDeclaration{
· SpecifierQualifierList: &cc.SpecifierQualifierList{
· · TypeSpecifier: &cc.TypeSpecifier{
· · · Case: 9,
· · · Token: example124.c:1:11: BOOL "_Bool",
· · },
· },
· StructDeclaratorList: &cc.StructDeclaratorList{
· · StructDeclarator: &cc.StructDeclarator{
· · · Declarator: &cc.Declarator{
· · · · Linkage: None,
· · · · Type: bool,
· · · · DirectDeclarator: &cc.DirectDeclarator{
· · · · · Token: example124.c:1:17: IDENTIFIER "a",
· · · · },
· · · },
· · },
· },
· Token: example124.c:1:19: ';',
}
Example (Case1)
fmt.Println(exampleAST(125, "\U00100002 struct { _Bool ; }"))
Output:

&cc.StructDeclaration{
· Case: 1,
· SpecifierQualifierList: &cc.SpecifierQualifierList{
· · TypeSpecifier: &cc.TypeSpecifier{
· · · Case: 9,
· · · Token: example125.c:1:11: BOOL "_Bool",
· · },
· },
· Token: example125.c:1:17: ';',
}
Example (Case2)
fmt.Println(exampleAST(126, "\U00100002 struct { _Static_assert ( 'a' , \"b\" ) ; }"))
Output:

&cc.StructDeclaration{
· Case: 2,
· StaticAssertDeclaration: &cc.StaticAssertDeclaration{
· · ConstantExpression: &cc.ConstantExpression{
· · · Type: int,
· · · Value: 97,
· · · Expression: &cc.Expression{
· · · · Type: int,
· · · · Value: 97,
· · · · Case: 1,
· · · · Token: example126.c:1:28: CHARCONST "'a'",
· · · },
· · },
· · Token: example126.c:1:11: STATIC_ASSERT "_Static_assert",
· · Token2: example126.c:1:26: '(',
· · Token3: example126.c:1:32: ',',
· · Token4: example126.c:1:34: STRINGLITERAL "\"b\"",
· · Token5: example126.c:1:38: ')',
· · Token6: example126.c:1:40: ';',
· },
}

func (*StructDeclaration) Pos

func (n *StructDeclaration) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StructDeclaration) String

func (n *StructDeclaration) String() string

String implements fmt.Stringer.

type StructDeclarationList

type StructDeclarationList struct {
	Case                  int
	StructDeclaration     *StructDeclaration
	StructDeclarationList *StructDeclarationList
}

StructDeclarationList represents data reduced by productions:

StructDeclarationList:
        StructDeclaration
|       StructDeclarationList StructDeclaration  // Case 1
Example
fmt.Println(exampleAST(122, "\U00100002 struct { _Bool ; }"))
Output:

&cc.StructDeclarationList{
· StructDeclaration: &cc.StructDeclaration{
· · Case: 1,
· · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · TypeSpecifier: &cc.TypeSpecifier{
· · · · Case: 9,
· · · · Token: example122.c:1:11: BOOL "_Bool",
· · · },
· · },
· · Token: example122.c:1:17: ';',
· },
}
Example (Case1)
fmt.Println(exampleAST(123, "\U00100002 struct { _Bool ; _Bool ; }"))
Output:

&cc.StructDeclarationList{
· StructDeclaration: &cc.StructDeclaration{
· · Case: 1,
· · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · TypeSpecifier: &cc.TypeSpecifier{
· · · · Case: 9,
· · · · Token: example123.c:1:11: BOOL "_Bool",
· · · },
· · },
· · Token: example123.c:1:17: ';',
· },
· StructDeclarationList: &cc.StructDeclarationList{
· · Case: 1,
· · StructDeclaration: &cc.StructDeclaration{
· · · Case: 1,
· · · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · · TypeSpecifier: &cc.TypeSpecifier{
· · · · · Case: 9,
· · · · · Token: example123.c:1:19: BOOL "_Bool",
· · · · },
· · · },
· · · Token: example123.c:1:25: ';',
· · },
· },
}

func (*StructDeclarationList) Pos

func (n *StructDeclarationList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StructDeclarationList) String

func (n *StructDeclarationList) String() string

String implements fmt.Stringer.

type StructDeclarator

type StructDeclarator struct {
	Case               int
	ConstantExpression *ConstantExpression
	Declarator         *Declarator
	DeclaratorOpt      *DeclaratorOpt
	Token              xc.Token
}

StructDeclarator represents data reduced by productions:

StructDeclarator:
        Declarator
|       DeclaratorOpt ':' ConstantExpression  // Case 1
Example
fmt.Println(exampleAST(133, "\U00100002 struct { _Bool a ,"))
Output:

&cc.StructDeclarator{
· Declarator: &cc.Declarator{
· · Linkage: None,
· · Type: bool,
· · DirectDeclarator: &cc.DirectDeclarator{
· · · Token: example133.c:1:17: IDENTIFIER "a",
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(134, "\U00100002 struct { _Bool : 'a' ,"))
Output:

&cc.StructDeclarator{
· Case: 1,
· ConstantExpression: &cc.ConstantExpression{
· · Type: int,
· · Value: 97,
· · Expression: &cc.Expression{
· · · Type: int,
· · · Value: 97,
· · · Case: 1,
· · · Token: example134.c:1:19: CHARCONST "'a'",
· · },
· },
· Token: example134.c:1:17: ':',
}

func (*StructDeclarator) Pos

func (n *StructDeclarator) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StructDeclarator) String

func (n *StructDeclarator) String() string

String implements fmt.Stringer.

type StructDeclaratorList

type StructDeclaratorList struct {
	Case                 int
	StructDeclarator     *StructDeclarator
	StructDeclaratorList *StructDeclaratorList
	Token                xc.Token
}

StructDeclaratorList represents data reduced by productions:

StructDeclaratorList:
        StructDeclarator
|       StructDeclaratorList ',' StructDeclarator  // Case 1
Example
fmt.Println(exampleAST(131, "\U00100002 struct { _Bool a ,"))
Output:

&cc.StructDeclaratorList{
· StructDeclarator: &cc.StructDeclarator{
· · Declarator: &cc.Declarator{
· · · Linkage: None,
· · · Type: bool,
· · · DirectDeclarator: &cc.DirectDeclarator{
· · · · Token: example131.c:1:17: IDENTIFIER "a",
· · · },
· · },
· },
}
Example (Case1)
fmt.Println(exampleAST(132, "\U00100002 struct { _Bool a , b ,"))
Output:

&cc.StructDeclaratorList{
· StructDeclarator: &cc.StructDeclarator{
· · Declarator: &cc.Declarator{
· · · Linkage: None,
· · · Type: bool,
· · · DirectDeclarator: &cc.DirectDeclarator{
· · · · Token: example132.c:1:17: IDENTIFIER "a",
· · · },
· · },
· },
· StructDeclaratorList: &cc.StructDeclaratorList{
· · Case: 1,
· · StructDeclarator: &cc.StructDeclarator{
· · · Declarator: &cc.Declarator{
· · · · Linkage: None,
· · · · Type: bool,
· · · · DirectDeclarator: &cc.DirectDeclarator{
· · · · · Token: example132.c:1:21: IDENTIFIER "b",
· · · · },
· · · },
· · },
· · Token: example132.c:1:19: ',',
· },
}

func (*StructDeclaratorList) Pos

func (n *StructDeclaratorList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StructDeclaratorList) String

func (n *StructDeclaratorList) String() string

String implements fmt.Stringer.

type StructOrUnion

type StructOrUnion struct {
	Case  int
	Token xc.Token
}

StructOrUnion represents data reduced by productions:

StructOrUnion:
        "struct"
|       "union"   // Case 1
Example
fmt.Println(exampleAST(120, "\U00100002 struct {"))
Output:

&cc.StructOrUnion{
· Token: example120.c:1:2: STRUCT "struct",
}
Example (Case1)
fmt.Println(exampleAST(121, "\U00100002 union {"))
Output:

&cc.StructOrUnion{
· Case: 1,
· Token: example121.c:1:2: UNION "union",
}

func (*StructOrUnion) Pos

func (n *StructOrUnion) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StructOrUnion) String

func (n *StructOrUnion) String() string

String implements fmt.Stringer.

type StructOrUnionSpecifier

type StructOrUnionSpecifier struct {
	Case                  int
	IdentifierOpt         *IdentifierOpt
	StructDeclarationList *StructDeclarationList
	StructOrUnion         *StructOrUnion
	Token                 xc.Token
	Token2                xc.Token
	// contains filtered or unexported fields
}

StructOrUnionSpecifier represents data reduced by productions:

StructOrUnionSpecifier:
        StructOrUnion IdentifierOpt '{' StructDeclarationList '}'
|       StructOrUnion IDENTIFIER                                   // Case 1
|       StructOrUnion IdentifierOpt '{' '}'                        // Case 2
Example
fmt.Println(exampleAST(117, "\U00100002 struct { int i; } ("))
Output:

&cc.StructOrUnionSpecifier{
· StructDeclarationList: &cc.StructDeclarationList{
· · StructDeclaration: &cc.StructDeclaration{
· · · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · · TypeSpecifier: &cc.TypeSpecifier{
· · · · · Case: 3,
· · · · · Token: example117.c:1:11: INT "int",
· · · · },
· · · },
· · · StructDeclaratorList: &cc.StructDeclaratorList{
· · · · StructDeclarator: &cc.StructDeclarator{
· · · · · Declarator: &cc.Declarator{
· · · · · · Linkage: None,
· · · · · · Type: int,
· · · · · · DirectDeclarator: &cc.DirectDeclarator{
· · · · · · · Token: example117.c:1:15: IDENTIFIER "i",
· · · · · · },
· · · · · },
· · · · },
· · · },
· · · Token: example117.c:1:16: ';',
· · },
· },
· StructOrUnion: &cc.StructOrUnion{
· · Token: example117.c:1:2: STRUCT "struct",
· },
· Token: example117.c:1:9: '{',
· Token2: example117.c:1:18: '}',
}
Example (Case1)
fmt.Println(exampleAST(118, "\U00100002 struct a ("))
Output:

&cc.StructOrUnionSpecifier{
· Case: 1,
· StructOrUnion: &cc.StructOrUnion{
· · Token: example118.c:1:2: STRUCT "struct",
· },
· Token: example118.c:1:9: IDENTIFIER "a",
}
Example (Case2)
fmt.Println(exampleAST(119, "\U00100002 struct { } ("))
Output:

&cc.StructOrUnionSpecifier{
· Case: 2,
· StructOrUnion: &cc.StructOrUnion{
· · Token: example119.c:1:2: STRUCT "struct",
· },
· Token: example119.c:1:9: '{',
· Token2: example119.c:1:11: '}',
}

func (*StructOrUnionSpecifier) Declarator

func (n *StructOrUnionSpecifier) Declarator() *Declarator

Declarator returns a synthetic Declarator when a tagged struc/union type is defined inline a declaration.

func (*StructOrUnionSpecifier) Pos

func (n *StructOrUnionSpecifier) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*StructOrUnionSpecifier) String

func (n *StructOrUnionSpecifier) String() string

String implements fmt.Stringer.

type TranslationUnit

type TranslationUnit struct {
	Comments            map[token.Pos]int // Position -> comment ID. Enable using the KeepComments option.
	Declarations        *Bindings
	Macros              map[int]*Macro // Ident ID -> preprocessor macro defined by ident.
	Model               *Model         // Model used to parse the TranslationUnit.
	Case                int
	ExternalDeclaration *ExternalDeclaration
	TranslationUnit     *TranslationUnit
}

TranslationUnit represents data reduced by productions:

TranslationUnit:
        ExternalDeclaration
|       TranslationUnit ExternalDeclaration  // Case 1
Example
fmt.Println(exampleAST(245, "\U00100002 ;"))
Output:

&cc.TranslationUnit{
· ExternalDeclaration: &cc.ExternalDeclaration{
· · Case: 3,
· · Token: example245.c:1:2: ';',
· },
}
Example (Case1)
fmt.Println(exampleAST(246, "\U00100002 ; ;"))
Output:

&cc.TranslationUnit{
· ExternalDeclaration: &cc.ExternalDeclaration{
· · Case: 3,
· · Token: example246.c:1:2: ';',
· },
· TranslationUnit: &cc.TranslationUnit{
· · Case: 1,
· · ExternalDeclaration: &cc.ExternalDeclaration{
· · · Case: 3,
· · · Token: example246.c:1:4: ';',
· · },
· },
}

func Parse

func Parse(predefine string, paths []string, m *Model, opts ...Opt) (*TranslationUnit, error)

Parse defines any macros in predefine. Then Parse preprocesses and parses the translation unit consisting of files in paths. The m communicates the scalar types model and opts allow to amend parser behavior. m cannot be reused and passed to Parse again.

func (*TranslationUnit) Pos

func (n *TranslationUnit) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*TranslationUnit) String

func (n *TranslationUnit) String() string

String implements fmt.Stringer.

type Type

type Type interface {
	// AlignOf returns the alignment in bytes of a value of this type when
	// allocated in memory not as a struct field. Incomplete struct types
	// have no alignment and the value returned will be < 0.
	AlignOf() int

	// Bits returns the bit width of the type's value. For non integral
	// types the returned value will < 0.
	Bits() int

	// SetBits returns a type instance with the value Bits() will return
	// equal to n. SetBits panics for n < 0.
	SetBits(n int) Type

	// CanAssignTo returns whether this type can be assigned to dst.
	CanAssignTo(dst Type) bool

	// Declarator returns the full Declarator which defined an entity of
	// this type. The returned declarator is possibly artificial.
	Declarator() *Declarator

	// RawDeclarator returns the typedef declarator associated with a type
	// if this type is a typedef name. Otherwise the normal declarator is
	// returned.
	RawDeclarator() *Declarator

	// Element returns the type this Ptr type points to or the element type
	// of an Array type.
	Element() Type

	// Elements returns the number of elements an Array type has. The
	// returned value is < 0 if this type is not an Array or if the array
	// is not of a constant size.
	Elements() int

	// EnumeratorList returns the enumeration constants defined by an Enum
	// type, if any.
	EnumeratorList() []EnumConstant

	// Kind returns one of Ptr, Void, Int, ...
	Kind() Kind

	// Member returns the type of a member of this Struct or Union type,
	// having numeric name identifier nm.
	Member(nm int) (*Member, error)

	// Members returns the members of a Struct or Union type in declaration
	// order. Returned members are valid iff non nil.
	//
	// Note: Non nil members of length 0 means the struct/union has no
	// members or the type is incomplete, which is indicated by the
	// isIncomplete return value.
	//
	// Note 2: C99 standard does not allow empty structs/unions, but GCC
	// supports that as an extension.
	Members() (members []Member, isIncomplete bool)

	// Parameters returns the parameters of a Function type in declaration
	// order. Result is valid iff params is not nil.
	//
	// Note: len(params) == 0 is fine and just means the function has no
	// parameters.
	Parameters() (params []Parameter, isVariadic bool)

	// Pointer returns a type that points to this type.
	Pointer() Type

	// Result returns the result type of a Function type.
	Result() Type

	// Sizeof returns the number of bytes needed to store a value of this
	// type. Incomplete struct types have no size and the value returned
	// will be < 0.
	SizeOf() int

	// Specifier returns the Specifier of this type.
	Specifier() Specifier

	// String returns a C-like type specifier of this type.
	String() string

	// StructAlignOf returns the alignment in bytes of a value of this type
	// when allocated in memory as a struct field. Incomplete struct types
	// have no alignment and the value returned will be < 0.
	StructAlignOf() int

	// Tag returns the ID of a tag of a Struct, Union or Enum type, if any.
	// Otherwise the returned value is zero.
	Tag() int
	// contains filtered or unexported methods
}

Type decribes properties of a C type.

type TypeName

type TypeName struct {
	Type Type

	AbstractDeclaratorOpt  *AbstractDeclaratorOpt
	SpecifierQualifierList *SpecifierQualifierList
	// contains filtered or unexported fields
}

TypeName represents data reduced by production:

TypeName:
        SpecifierQualifierList AbstractDeclaratorOpt
Example
fmt.Println(exampleAST(184, "\U00100001 ( _Bool )"))
Output:

&cc.TypeName{
· Type: bool,
· SpecifierQualifierList: &cc.SpecifierQualifierList{
· · TypeSpecifier: &cc.TypeSpecifier{
· · · Case: 9,
· · · Token: example184.c:1:4: BOOL "_Bool",
· · },
· },
}

func (*TypeName) Pos

func (n *TypeName) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*TypeName) String

func (n *TypeName) String() string

String implements fmt.Stringer.

type TypeQualifier

type TypeQualifier struct {
	Case  int
	Token xc.Token
	// contains filtered or unexported fields
}

TypeQualifier represents data reduced by productions:

TypeQualifier:
        "const"
|       "restrict"  // Case 1
|       "volatile"  // Case 2
Example
fmt.Println(exampleAST(144, "\U00100002 const !"))
Output:

&cc.TypeQualifier{
· Token: example144.c:1:2: CONST "const",
}
Example (Case1)
fmt.Println(exampleAST(145, "\U00100002 restrict !"))
Output:

&cc.TypeQualifier{
· Case: 1,
· Token: example145.c:1:2: RESTRICT "restrict",
}
Example (Case2)
fmt.Println(exampleAST(146, "\U00100002 volatile !"))
Output:

&cc.TypeQualifier{
· Case: 2,
· Token: example146.c:1:2: VOLATILE "volatile",
}

func (*TypeQualifier) Pos

func (n *TypeQualifier) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*TypeQualifier) String

func (n *TypeQualifier) String() string

String implements fmt.Stringer.

type TypeQualifierList

type TypeQualifierList struct {
	Case              int
	TypeQualifier     *TypeQualifier
	TypeQualifierList *TypeQualifierList
	// contains filtered or unexported fields
}

TypeQualifierList represents data reduced by productions:

TypeQualifierList:
        TypeQualifier
|       TypeQualifierList TypeQualifier  // Case 1
Example
fmt.Println(exampleAST(165, "\U00100002 * const !"))
Output:

&cc.TypeQualifierList{
· TypeQualifier: &cc.TypeQualifier{
· · Token: example165.c:1:4: CONST "const",
· },
}
Example (Case1)
fmt.Println(exampleAST(166, "\U00100002 * const const !"))
Output:

&cc.TypeQualifierList{
· TypeQualifier: &cc.TypeQualifier{
· · Token: example166.c:1:4: CONST "const",
· },
· TypeQualifierList: &cc.TypeQualifierList{
· · Case: 1,
· · TypeQualifier: &cc.TypeQualifier{
· · · Token: example166.c:1:10: CONST "const",
· · },
· },
}

func (*TypeQualifierList) Pos

func (n *TypeQualifierList) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*TypeQualifierList) String

func (n *TypeQualifierList) String() string

String implements fmt.Stringer.

type TypeQualifierListOpt

type TypeQualifierListOpt struct {
	TypeQualifierList *TypeQualifierList
}

TypeQualifierListOpt represents data reduced by productions:

TypeQualifierListOpt:
        /* empty */
|       TypeQualifierList  // Case 1
Example
fmt.Println(exampleAST(167, "\U00100002 * (") == (*TypeQualifierListOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(168, "\U00100002 * const !"))
Output:

&cc.TypeQualifierListOpt{
· TypeQualifierList: &cc.TypeQualifierList{
· · TypeQualifier: &cc.TypeQualifier{
· · · Token: example168.c:1:4: CONST "const",
· · },
· },
}

func (*TypeQualifierListOpt) Pos

func (n *TypeQualifierListOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*TypeQualifierListOpt) String

func (n *TypeQualifierListOpt) String() string

String implements fmt.Stringer.

type TypeSpecifier

type TypeSpecifier struct {
	Type                   Type // Type of typeof.
	Case                   int
	EnumSpecifier          *EnumSpecifier
	Expression             *Expression
	StructOrUnionSpecifier *StructOrUnionSpecifier
	Token                  xc.Token
	Token2                 xc.Token
	Token3                 xc.Token
	TypeName               *TypeName
	// contains filtered or unexported fields
}

TypeSpecifier represents data reduced by productions:

TypeSpecifier:
        "void"
|       "char"                       // Case 1
|       "short"                      // Case 2
|       "int"                        // Case 3
|       "long"                       // Case 4
|       "float"                      // Case 5
|       "double"                     // Case 6
|       "signed"                     // Case 7
|       "unsigned"                   // Case 8
|       "_Bool"                      // Case 9
|       "_Complex"                   // Case 10
|       StructOrUnionSpecifier       // Case 11
|       EnumSpecifier                // Case 12
|       TYPEDEFNAME                  // Case 13
|       "typeof" '(' Expression ')'  // Case 14
|       "typeof" '(' TypeName ')'    // Case 15
Example
fmt.Println(exampleAST(100, "\U00100002 void ("))
Output:

&cc.TypeSpecifier{
· Token: example100.c:1:2: VOID "void",
}
Example (Case01)
fmt.Println(exampleAST(101, "\U00100002 char ("))
Output:

&cc.TypeSpecifier{
· Case: 1,
· Token: example101.c:1:2: CHAR "char",
}
Example (Case02)
fmt.Println(exampleAST(102, "\U00100002 short ("))
Output:

&cc.TypeSpecifier{
· Case: 2,
· Token: example102.c:1:2: SHORT "short",
}
Example (Case03)
fmt.Println(exampleAST(103, "\U00100002 int ("))
Output:

&cc.TypeSpecifier{
· Case: 3,
· Token: example103.c:1:2: INT "int",
}
Example (Case04)
fmt.Println(exampleAST(104, "\U00100002 long ("))
Output:

&cc.TypeSpecifier{
· Case: 4,
· Token: example104.c:1:2: LONG "long",
}
Example (Case05)
fmt.Println(exampleAST(105, "\U00100002 float ("))
Output:

&cc.TypeSpecifier{
· Case: 5,
· Token: example105.c:1:2: FLOAT "float",
}
Example (Case06)
fmt.Println(exampleAST(106, "\U00100002 double ("))
Output:

&cc.TypeSpecifier{
· Case: 6,
· Token: example106.c:1:2: DOUBLE "double",
}
Example (Case07)
fmt.Println(exampleAST(107, "\U00100002 signed ("))
Output:

&cc.TypeSpecifier{
· Case: 7,
· Token: example107.c:1:2: SIGNED "signed",
}
Example (Case08)
fmt.Println(exampleAST(108, "\U00100002 unsigned ("))
Output:

&cc.TypeSpecifier{
· Case: 8,
· Token: example108.c:1:2: UNSIGNED "unsigned",
}
Example (Case09)
fmt.Println(exampleAST(109, "\U00100002 _Bool ("))
Output:

&cc.TypeSpecifier{
· Case: 9,
· Token: example109.c:1:2: BOOL "_Bool",
}
Example (Case10)
fmt.Println(exampleAST(110, "\U00100002 _Complex ("))
Output:

&cc.TypeSpecifier{
· Case: 10,
· Token: example110.c:1:2: COMPLEX "_Complex",
}
Example (Case11)
fmt.Println(exampleAST(111, "\U00100002 struct a ("))
Output:

&cc.TypeSpecifier{
· Case: 11,
· StructOrUnionSpecifier: &cc.StructOrUnionSpecifier{
· · Case: 1,
· · StructOrUnion: &cc.StructOrUnion{
· · · Token: example111.c:1:2: STRUCT "struct",
· · },
· · Token: example111.c:1:9: IDENTIFIER "a",
· },
}
Example (Case12)
fmt.Println(exampleAST(112, "\U00100002 enum a ("))
Output:

&cc.TypeSpecifier{
· Case: 12,
· EnumSpecifier: &cc.EnumSpecifier{
· · Case: 1,
· · Token: example112.c:1:2: ENUM "enum",
· · Token2: example112.c:1:7: IDENTIFIER "a",
· },
}
Example (Case13)
fmt.Println(exampleAST(113, "\U00100002 typedef int i; i j;"))
Output:

&cc.TypeSpecifier{
· Case: 13,
· Token: example113.c:1:17: TYPEDEFNAME "i",
}
Example (Case14)
fmt.Println(exampleAST(114, "\U00100002 typeof ( 'a' ) ("))
Output:

&cc.TypeSpecifier{
· Type: int,
· Case: 14,
· Expression: &cc.Expression{
· · Type: int,
· · Value: 97,
· · Case: 1,
· · Token: example114.c:1:11: CHARCONST "'a'",
· },
· Token: example114.c:1:2: TYPEOF "typeof",
· Token2: example114.c:1:9: '(',
· Token3: example114.c:1:15: ')',
}
Example (Case15)
fmt.Println(exampleAST(115, "\U00100002 typeof ( _Bool ) ("))
Output:

&cc.TypeSpecifier{
· Type: bool,
· Case: 15,
· Token: example115.c:1:2: TYPEOF "typeof",
· Token2: example115.c:1:9: '(',
· Token3: example115.c:1:17: ')',
· TypeName: &cc.TypeName{
· · Type: bool,
· · SpecifierQualifierList: &cc.SpecifierQualifierList{
· · · TypeSpecifier: &cc.TypeSpecifier{
· · · · Case: 9,
· · · · Token: example115.c:1:11: BOOL "_Bool",
· · · },
· · },
· },
}

func (*TypeSpecifier) Pos

func (n *TypeSpecifier) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*TypeSpecifier) String

func (n *TypeSpecifier) String() string

String implements fmt.Stringer.

type VolatileOpt

type VolatileOpt struct {
	Token xc.Token
}

VolatileOpt represents data reduced by productions:

VolatileOpt:
        /* empty */
|       "volatile"   // Case 1
Example
fmt.Println(exampleAST(268, "\U00100002 asm (") == (*VolatileOpt)(nil))
Output:

true
Example (Case1)
fmt.Println(exampleAST(269, "\U00100002 asm volatile ("))
Output:

&cc.VolatileOpt{
· Token: example269.c:1:6: VOLATILE "volatile",
}

func (*VolatileOpt) Pos

func (n *VolatileOpt) Pos() token.Pos

Pos reports the position of the first component of n or zero if it's empty.

func (*VolatileOpt) String

func (n *VolatileOpt) String() string

String implements fmt.Stringer.

Directories

Path Synopsis
Package cc is a C99 compiler front end.
Package cc is a C99 compiler front end.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL