Skip to content

Commit 4f26831

Browse files
committed
Small things...
1 parent 239c9da commit 4f26831

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ A separate [command line program](preprocess-cl.lua) is available too.
2727

2828

2929
## Example Program
30-
The exclamation mark (!) is used to indicate what code is part of the metaprogram. ([See screenshot of processing steps with highlighting](misc/processingSteps.png))
30+
The exclamation mark (!) is used to indicate what code is part of the metaprogram.
31+
([See screenshot of processing steps with highlighting](https://raw.githubusercontent.com/ReFreezed/LuaPreprocess/master/misc/processingSteps.png))
3132

3233
```lua
3334
-- Normal Lua.

misc/quickTest.lua2p

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ print("The end.")
7171

7272
!(
7373
--[==[ Test token stuff.
74-
for i, token in ipairs(assert(tokenize(getFileContents"quickTestInclude.lua"))) do
74+
for i, token in ipairs(assert(tokenize(assert(getFileContents"misc/quickTestInclude.lua")))) do
7575
print(i, token.type, "", (token.representation:gsub("\n", "<NEWLINE>")))
7676
end
7777

@@ -109,6 +109,8 @@ for _, token in ipairs{
109109
-- newToken("whitespace", "foo"), -- Error!
110110
newToken("pp_entry", false),
111111
newToken("pp_entry", true),
112+
newToken("pp_keyword", "insert"),
113+
-- newToken("pp_keyword", "foo"), -- Error!
112114
-- newToken("nope", nil), -- Error!
113115
} do
114116
print("------------------------")

misc/runQuickTest.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ REM lua preprocess-cl.lua --debug --saveinfo=local/info.lua --data="Hello, world
99
REM lua preprocess-cl.lua --debug --saveinfo=local/info.lua --data="Hello, world!" --outputpaths misc/quickTest.lua2p local/quickTest.output.lua
1010
REM lua preprocess-cl.lua --debug --saveinfo=local/info.lua --data="Hello, world!" --outputpaths misc/quickTest.lua2p local/quickTest.output.lua --linenumbers
1111

12-
lua misc/quickTest.lua
12+
IF %ERRORLEVEL% EQU 0 lua misc/quickTest.lua

misc/runQuickTestUsingHandler.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ IF NOT EXIST local MD local
66
lua preprocess-cl.lua --debug --saveinfo=local/info.lua --handler=misc/quickTestHandler.lua misc/quickTest.lua2p
77
REM lua preprocess-cl.lua --debug --saveinfo=local/info.lua --handler=misc/quickTestHandler.lua --outputpaths misc/quickTest.lua2p local/quickTest.output.lua
88

9-
lua misc/quickTest.lua
9+
IF %ERRORLEVEL% EQU 0 lua misc/quickTest.lua

preprocess.lua

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,25 +1216,25 @@ end
12161216
-- Create a new token. Different token types take different arguments.
12171217
-- token = newToken( tokenType, ... )
12181218
--
1219-
-- commentToken = newToken( "comment", contents [, forceLongForm=false ] )
1220-
-- identifierToken = newToken( "identifier", identifier )
1221-
-- keywordToken = newToken( "keyword", keyword )
1222-
-- numberToken = newToken( "number", number [, numberFormat="auto" ] )
1223-
-- punctuationToken = newToken( "punctuation", symbol )
1224-
-- stringToken = newToken( "string", contents [, longForm=false ] )
1225-
-- whitespaceToken = newToken( "whitespace", contents )
1226-
-- preprocessorToken = newToken( "pp_entry", isDouble )
1227-
-- preprocessorToken = newToken( "pp_keyword", keyword )
1219+
-- commentToken = newToken( "comment", contents [, forceLongForm=false ] )
1220+
-- identifierToken = newToken( "identifier", identifier )
1221+
-- keywordToken = newToken( "keyword", keyword )
1222+
-- numberToken = newToken( "number", number [, numberFormat="auto" ] )
1223+
-- punctuationToken = newToken( "punctuation", symbol )
1224+
-- stringToken = newToken( "string", contents [, longForm=false ] )
1225+
-- whitespaceToken = newToken( "whitespace", contents )
1226+
-- ppEntryToken = newToken( "pp_entry", isDouble )
1227+
-- ppKeywordToken = newToken( "pp_keyword", keyword )
12281228
--
1229-
-- commentToken = { type="comment", representation=string, value=string, long=isLongForm }
1230-
-- identifierToken = { type="identifier", representation=string, value=string }
1231-
-- keywordToken = { type="keyword", representation=string, value=string }
1232-
-- numberToken = { type="number", representation=string, value=number }
1233-
-- punctuationToken = { type="punctuation", representation=string, value=string }
1234-
-- stringToken = { type="string", representation=string, value=string, long=isLongForm }
1235-
-- whitespaceToken = { type="whitespace", representation=string, value=string }
1236-
-- preprocessorToken = { type="pp_entry", representation=string, value=string, double=isDouble }
1237-
-- preprocessorToken = { type="pp_keyword", representation=string, value=string }
1229+
-- commentToken = { type="comment", representation=string, value=string, long=isLongForm }
1230+
-- identifierToken = { type="identifier", representation=string, value=string }
1231+
-- keywordToken = { type="keyword", representation=string, value=string }
1232+
-- numberToken = { type="number", representation=string, value=number }
1233+
-- punctuationToken = { type="punctuation", representation=string, value=string }
1234+
-- stringToken = { type="string", representation=string, value=string, long=isLongForm }
1235+
-- whitespaceToken = { type="whitespace", representation=string, value=string }
1236+
-- ppEntryToken = { type="pp_entry", representation=string, value=string, double=isDouble }
1237+
-- ppKeywordToken = { type="pp_keyword", representation=string, value=string }
12381238
--
12391239
-- Number formats:
12401240
-- "integer" E.g. 42

0 commit comments

Comments
 (0)