summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-13 23:14:03 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-13 23:14:03 +0100
commit6c7d53071fc0334482bcb8c349987d19ee01babe (patch)
tree3c1995905d27807ecf134489ef2a971519d320b4
parent2ab1b5490ba78c0566da6151ca40bb58e40df1f4 (diff)
downloadlace-6c7d53071fc0334482bcb8c349987d19ee01babe.tar.gz
Remove files from lexer interface, it's not needed
-rw-r--r--lib/lace/lex.lua11
-rw-r--r--test/test-lace.lex.lua18
-rw-r--r--test/test-lace.lex.rules5
3 files changed, 0 insertions, 34 deletions
diff --git a/lib/lace/lex.lua b/lib/lace/lex.lua
index 6210a36..f8e5160 100644
--- a/lib/lace/lex.lua
+++ b/lib/lace/lex.lua
@@ -110,17 +110,6 @@ local function lex_a_ruleset(ruleset, sourcename)
return ret
end
-local function lex_a_file(filename)
- local fh, err = sio.open(filename, "r")
- if not fh then
- return nil, "Unable to open " .. tostring(filename) .. ": " .. tostring(err)
- end
- local ruleset = fh:read("*a")
- fh:close()
- return lex_a_ruleset(ruleset, "@" .. filename)
-end
-
return {
- file = lex_a_file,
string = lex_a_ruleset,
}
diff --git a/test/test-lace.lex.lua b/test/test-lace.lex.lua
index 8f89bf3..5d9d552 100644
--- a/test/test-lace.lex.lua
+++ b/test/test-lace.lex.lua
@@ -248,24 +248,6 @@ function suite.escape_inside_unclosed_unused()
assert(content.lines[1].warnings[2]:find("escape"), "The warning should be about the escape")
end
-function suite.load_unknown_file()
- local ok, msg = lex.file("test/NOT-PRESENT")
- assert(not ok, "Managed to lex a non-present file?!")
- assert(msg:match 'Unable to open', "Error doesn't seem right")
-end
-
-function suite.load_known_file()
- local content = assert(lex.file("test/test-lace.lex.rules"))
- assert(content.source == "@test/test-lace.lex.rules")
- assert(type(content.lines) == "table", "Lines is not a table")
- assert(#content.lines == 5, "There should have been five lines")
- assert(content.lines[1].type == "comment", "Line 1 should be a comment")
- assert(content.lines[2].type == "comment", "Line 2 should be a comment")
- assert(content.lines[3].type == "comment", "Line 3 should be a comment")
- assert(content.lines[4].type == "whitespace", "Line 3 should be whitespace")
- assert(content.lines[5].type == "rule", "Line 3 should be a rule")
-end
-
local count_ok = 0
for _, testname in ipairs(testnames) do
print("Run: " .. testname)
diff --git a/test/test-lace.lex.rules b/test/test-lace.lex.rules
deleted file mode 100644
index c3acc51..0000000
--- a/test/test-lace.lex.rules
+++ /dev/null
@@ -1,5 +0,0 @@
--- Trivial ruleset should total 5 lines
-// The first three are comments
-# The fourth is whitespace and the fifth is a statement of 2 words
-
- deny "I hate world"