Adds backslash as a build in constant
This commit is contained in:
parent
5369c15e05
commit
49e1bf204f
@ -409,6 +409,7 @@ def emitheader():
|
||||
emitln(" if os.environ.get('TRACE'):")
|
||||
emitln(" sys.stderr.write(f'{header}={value!r}\\n')")
|
||||
emitln("")
|
||||
emitln("__BACKSLASH = chr(0x5C)")
|
||||
emitln("__EOF = chr(0xFF)")
|
||||
emitln("__EOL = chr(10)")
|
||||
emitln("__QUOTE = chr(34)")
|
||||
@ -495,6 +496,7 @@ def main():
|
||||
emitheader()
|
||||
|
||||
# Standard library constants
|
||||
mapsetkey("REGISTERID", "backslash", "__BACKSLASH")
|
||||
mapsetkey("REGISTERID", "eof", "__EOF")
|
||||
mapsetkey("REGISTERID", "eol", "__EOL")
|
||||
mapsetkey("REGISTERID", "quote", "__QUOTE")
|
||||
|
||||
@ -472,6 +472,7 @@ emitheader:
|
||||
emitln " if os.environ.get('TRACE'):"
|
||||
emitln " sys.stderr.write(f'{header}={value!r}\\n')"
|
||||
emitln ""
|
||||
emitln "__BACKSLASH = chr(0x5C)"
|
||||
emitln "__EOF = chr(0xFF)"
|
||||
emitln "__EOL = chr(10)"
|
||||
emitln "__QUOTE = chr(34)"
|
||||
@ -557,6 +558,7 @@ emitfooter:
|
||||
main:
|
||||
emitheader
|
||||
|
||||
mapsetkey "REGISTERID" "backslash" "__BACKSLASH"
|
||||
mapsetkey "REGISTERID" "eof" "__EOF"
|
||||
mapsetkey "REGISTERID" "eol" "__EOL"
|
||||
mapsetkey "REGISTERID" "quote" "__QUOTE"
|
||||
|
||||
@ -574,6 +574,7 @@ emitheader:
|
||||
emitln "#include <string.h>"
|
||||
emitln ""
|
||||
emitln ""
|
||||
emitln "char __BACKSLASH[2] = {0x5C, 0};"
|
||||
emitln "char __EOF[2] = {0xFF, 0};"
|
||||
emitln "char __EOL[2] = {10, 0};"
|
||||
emitln "char __QUOTE[2] = {34, 0};"
|
||||
@ -849,6 +850,7 @@ main:
|
||||
|
||||
emitheader
|
||||
|
||||
mapsetkey "REGISTERID" "backslash" "__BACKSLASH"
|
||||
mapsetkey "REGISTERID" "eof" "__EOF"
|
||||
mapsetkey "REGISTERID" "eol" "__EOL"
|
||||
mapsetkey "REGISTERID" "quote" "__QUOTE"
|
||||
|
||||
@ -123,6 +123,10 @@ Writes the name and value of the variable passed to stderr if the TRACE environm
|
||||
|
||||
### Standard library constants
|
||||
|
||||
#### backslash
|
||||
|
||||
Backslash character.
|
||||
|
||||
#### eof
|
||||
|
||||
End of file character, zero byte.
|
||||
|
||||
1
tests/test_stdlib_constants/test_backslash.exp.stdout
Normal file
1
tests/test_stdlib_constants/test_backslash.exp.stdout
Normal file
@ -0,0 +1 @@
|
||||
\
|
||||
3
tests/test_stdlib_constants/test_backslash.lang0
Normal file
3
tests/test_stdlib_constants/test_backslash.lang0
Normal file
@ -0,0 +1,3 @@
|
||||
main:
|
||||
emit backslash
|
||||
/
|
||||
Loading…
x
Reference in New Issue
Block a user