yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
7f1df9d0b
master
1// slang-token-defs.h 2 3// This file is meant to be included multiple times, to produce different 4// pieces of code related to tokens 5// 6// Each token is declared here with: 7// 8// TOKEN(id, desc) 9// 10// where `id` is the identifier that will be used for the token in 11// ordinary code, while `desc` is name we should print when 12// referring to this token in diagnostic messages. 13 14 15#ifndef TOKEN 16#error Need to define TOKEN(ID, DESC) before including "token-defs.h" 17#endif 18 19TOKEN (Unknown ,"<unknown>" ) 20TOKEN (EndOfFile ,"end of file" ) 21TOKEN (Invalid ,"invalid character" ) 22TOKEN (Identifier ,"identifier" ) 23TOKEN (IntegerLiteral ,"integer literal" ) 24TOKEN (FloatingPointLiteral ,"floating-point literal" ) 25TOKEN (StringLiteral ,"string literal" ) 26TOKEN (CharLiteral ,"character literal" ) 27TOKEN (WhiteSpace ,"whitespace" ) 28TOKEN (NewLine ,"end of line" ) 29TOKEN (LineComment ,"line comment" ) 30TOKEN (BlockComment ,"block comment" ) 31 32#define PUNCTUATION (id ,text ) TOKEN(id, "'" text "'") 33 34PUNCTUATION (Semicolon ,";" ) 35PUNCTUATION (Comma ,"," ) 36PUNCTUATION (Dot ,"." ) 37PUNCTUATION (DotDot ,".." ) 38PUNCTUATION (Ellipsis ,"..." ) 39 40PUNCTUATION (LBrace ,"{" ) 41PUNCTUATION (RBrace ,"}" ) 42PUNCTUATION (LBracket ,"[" ) 43PUNCTUATION (RBracket ,"]" ) 44PUNCTUATION (LParent ,"(" ) 45PUNCTUATION (RParent ,")" ) 46 47PUNCTUATION (OpAssign ,"=" ) 48PUNCTUATION (OpAdd ,"+" ) 49PUNCTUATION (OpSub ,"-" ) 50PUNCTUATION (OpMul ,"*" ) 51PUNCTUATION (OpDiv ,"/" ) 52PUNCTUATION (OpMod ,"%" ) 53PUNCTUATION (OpNot ,"!" ) 54PUNCTUATION (OpBitNot ,"~" ) 55PUNCTUATION (OpLsh ,"<<" ) 56PUNCTUATION (OpRsh ,">>" ) 57PUNCTUATION (OpEql ,"==" ) 58PUNCTUATION (OpNeq ,"!=" ) 59PUNCTUATION (OpGreater ,">" ) 60PUNCTUATION (OpLess ,"<" ) 61PUNCTUATION (OpGeq ,">=" ) 62PUNCTUATION (OpLeq ,"<=" ) 63PUNCTUATION (OpAnd ,"&&" ) 64PUNCTUATION (OpOr ,"||" ) 65PUNCTUATION (OpBitAnd ,"&" ) 66PUNCTUATION (OpBitOr ,"|" ) 67PUNCTUATION (OpBitXor ,"^" ) 68PUNCTUATION (OpInc ,"++" ) 69PUNCTUATION (OpDec ,"--" ) 70 71PUNCTUATION (OpAddAssign ,"+=" ) 72PUNCTUATION (OpSubAssign ,"-=" ) 73PUNCTUATION (OpMulAssign ,"*=" ) 74PUNCTUATION (OpDivAssign ,"/=" ) 75PUNCTUATION (OpModAssign ,"%=" ) 76PUNCTUATION (OpShlAssign ,"<<=" ) 77PUNCTUATION (OpShrAssign ,">>=" ) 78PUNCTUATION (OpAndAssign ,"&=" ) 79PUNCTUATION (OpOrAssign ,"|=" ) 80PUNCTUATION (OpXorAssign ,"^=" ) 81 82PUNCTUATION (QuestionMark ,"?" ) 83PUNCTUATION (Colon ,":" ) 84PUNCTUATION (RightArrow ,"->" ) 85PUNCTUATION (DoubleRightArrow ,"=>" ) 86PUNCTUATION (At ,"@" ) 87PUNCTUATION (Dollar ,"$" ) 88PUNCTUATION (DollarDollar ,"$$" ) 89PUNCTUATION (Pound ,"#" ) 90PUNCTUATION (PoundPound ,"##" ) 91 92PUNCTUATION (Scope ,"::" ) 93 94PUNCTUATION (CompletionRequest ,"#?" ) 95 96#undef PUNCTUATION 97 98// Un-define the `TOKEN` macro so that client doesn't have to 99#undef TOKEN