New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua scanner #21
Closed
Closed
Lua scanner #21
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:reserved would be a more fitting token kind than :predefined, but unfortunately :reserved looks like :keyword in Coderay’s default stylesheet and this is NOT the same in Lua.
tbl2 = { [30] = 10, a = 1, [{["a"] = "f"}] = 4, c = {a = 5}, d = {a = 3, b = "fff", {["foo"] = 1}}, e = 9, "foo", {}, true, 3 } Nice, ain’t it?
…tor. tbl = {} function tbl:foo(self) print("foo") end
x = function() print("anon") end
…vided by the `base' library. print, error, garbagecollect, ...
Note Lua has no unary +.
You should probably squash those into one commit; otherwise great job! |
OK, I’m going to do so... Vale, |
I just reopen this one because it contains important information about your code. |
ghost
assigned korny
Jun 25, 2012
👍 |
+1, I still want a Lua scanner. I'm going to attempt to create my own based on this work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
I’ve written a CodeRay scanner for the Lua programming language as I’m currently doing a lot of Lua stuff and because CodeRay is my favourite code highlighter I thought someone had to do something about this definite lack of features ;-)
I’ve tested the scanner with a good portion of obscure Lua code, but of course it’s possible that it may doesn’t recognize something it has to or the other way round.
Regarding Lua’s length operator # I wasn’t sure whether to parse expressions using it directly as integer, because although that operator is intended to return the "length" of something, it’s possible to overwrite it like this:
That way it doesn’t return an integral value after all. So, shall I add this feature or not?
Finally I don’t really like the CSS style I’ve added for the Lua table definitions, but I’ve not yet digged that much in things such as hsla expressions in CSS. But changing that one shouldn’t be too hard ;-)
I’ve implemented the scanner by reference to the official manual for Lua 5.2 which claims to cover the Lua language completely and as far as I can see the scanner covers everything mentioned there.
Thanks for consideration!
Valete,
Quintus