PP: Implement token pasting for PP identifiers.

Implement token pasting as per the C++ specification, within the current
style of the PP code.
Non-identifiers (turning 12 ## 10 into the numeral 1210) is not yet covered;
they should be a simple incremental change built on this one.
Addresses issue #255.
This commit is contained in:
John Kessenich
2016-12-19 09:19:43 -07:00
parent abf5057948
commit d485e0b710
10 changed files with 304 additions and 34 deletions

View File

@@ -0,0 +1,60 @@
tokenPaste.vert
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:38: '##' : unexpected location
ERROR: 0:40: '##' : unexpected location; end of replacement list
ERROR: 0:49: '##' : combined tokens are too long
ERROR: 0:52: '##' : only supported for preprocessing identifiers
ERROR: 4 compilation errors. No code generated.
Shader version: 450
ERROR: node is still EOpNull!
0:52 Sequence
0:52 move second child to first child (temp int)
0:52 'a' (global int)
0:52 Constant:
0:52 11 (const int)
0:? Linker Objects
0:? 'SecondExpansion' (global int)
0:? 'PostPasteExpansion' (global int)
0:? 'foo27' (global float)
0:? 'foo155' (uniform float)
0:? 'foo719' (global float)
0:? 'barfoo' (uniform float)
0:? 'argless' (global float)
0:? 'dc1' (global float)
0:? 'dc2' (global float)
0:? 'foo875' (uniform float)
0:? 'ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123451234' (global float)
0:? 'a' (global int)
0:? 'gl_VertexID' (gl_VertexId int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId int InstanceId)
Linked vertex stage:
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
Shader version: 450
ERROR: node is still EOpNull!
0:52 Sequence
0:52 move second child to first child (temp int)
0:52 'a' (global int)
0:52 Constant:
0:52 11 (const int)
0:? Linker Objects
0:? 'SecondExpansion' (global int)
0:? 'PostPasteExpansion' (global int)
0:? 'foo27' (global float)
0:? 'foo155' (uniform float)
0:? 'foo719' (global float)
0:? 'barfoo' (uniform float)
0:? 'argless' (global float)
0:? 'dc1' (global float)
0:? 'dc2' (global float)
0:? 'foo875' (uniform float)
0:? 'ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123451234' (global float)
0:? 'a' (global int)
0:? 'gl_VertexID' (gl_VertexId int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId int InstanceId)