138 Commits

Author SHA1 Message Date
Niko Matsakis
bf2945a6b4 self-hosted parsing is kinda working -- except that
I didn't implement yet the handling of patterns
2015-07-24 06:58:01 -04:00
Niko Matsakis
d67e04f5e4 setup (but don't yet use) a self-hosting scheme. newparser.rs does
successfully convert though.
2015-07-24 06:01:33 -04:00
Niko Matsakis
3c67e3c8c5 add LALRPOP grammar written in itself; generates quite a lot of output
though -- probably need to shift to a less naive LR(1) generation
algorithm
2015-07-24 05:54:53 -04:00
Niko Matsakis
bd006f8c27 add an interesting test for an S/R conflict and patch up LALRPOP tokenizer 2015-07-24 05:54:25 -04:00
Niko Matsakis
5890485b20 Patch up tokenizer for use/where; use is_xid_start from cargo 2015-07-24 05:06:42 -04:00
Niko Matsakis
1d4c5d3efc separate out pre/post-validation in order to properly check for
terminals without defined conversions; also, eliminate the default
conversion
2015-07-23 08:50:12 -04:00
Niko Matsakis
b872e3d68f tweak error.lalrpop 2015-07-21 20:49:47 -04:00
Niko Matsakis
110db353fc fix tyinfer test 2015-07-21 20:49:09 -04:00
Niko Matsakis
1bbfb9d764 let users specify fallible rules (and the error type) 2015-07-21 12:45:38 -04:00
Niko Matsakis
69a881d4a5 Rename @< and @> to @L and @R 2015-07-21 06:50:41 -04:00
Niko Matsakis
b08e0cfe17 make it possible for tokenizer to generate errors (and thread the
logic through); use traits to be relatively seamless in what
we accept
2015-07-21 06:22:29 -04:00
Niko Matsakis
4c39cc7f2b Merge branch 'master' of github.com:nikomatsakis/lalrpop 2015-07-21 05:21:32 -04:00
Niko Matsakis
0be8a9388f Merge branch 'master' of github.com:nikomatsakis/lalrpop 2015-07-21 05:19:34 -04:00
Niko Matsakis
0530810f10 modify generate code to require a utility library (lalrpop-util) and
to generate errors based on the error type defined therein
2015-07-21 05:18:32 -04:00
Niko Matsakis
d4a13ba84f Merge pull request #11 from wycats/patch-1
Fix typo
2015-07-20 15:17:42 -04:00
Niko Matsakis
91dc00aa89 better test for using super 2015-07-20 13:02:15 -04:00
Niko Matsakis
9f4c82cf36 refactor how we handle locations so that it is only the parse_FOO
function that does the adaptation for optional location information (is
optional location information even worth it, or should we just default
to `()`)?
2015-07-20 06:18:59 -04:00
Niko Matsakis
8d1fed1e25 change parse_Foo so that it expects to consume entire input;
later we'll make a version called `resume_Foo` or something that
lets you supply the initial state (lookbehind, lookahead, etc)
in its entirety
2015-07-20 05:43:07 -04:00
Niko Matsakis
2383a021c9 change the behavior of @< and friends so that instead of supplying
`None`, they use `Default::default`. You can always give an option
yourself if that's what you want, after all, but most of the time
it's kind of annoying!
2015-07-20 05:36:52 -04:00
Niko Matsakis
ae37f374cc move the action code back into the parent module so that super::
resolves correctly (as I originally intended, but forgot) and
add a test
2015-07-20 05:21:12 -04:00
Niko Matsakis
0ec6824eeb fix escape test 2015-07-19 14:20:59 -04:00
Niko Matsakis
d5b2603bcb fix minor thing with string literal spans (and add a test) 2015-07-19 14:14:40 -04:00
Niko Matsakis
09f00f7a56 test for the various kinds of ids 2015-07-19 14:08:27 -04:00
Niko Matsakis
4c74cc6873 Move the LALRPOP tokenizer into lalrpop itself; rename the existing
token to lexer; add a few more tests and fix a bug in `test`
2015-07-19 14:03:00 -04:00
Niko Matsakis
a40f774ecc initial take on a tokenizer for LALRPOP 2015-07-19 13:05:34 -04:00
Niko Matsakis
6da930bbf6 get lookahead/lookbehind working, and add a test to laprpop-test for it 2015-07-18 18:14:39 -04:00
Niko Matsakis
f758e0ff00 thread through most of the work to support lookahead/lookbehind,
but not the actual expansion (untested, clearly)
2015-07-18 06:40:30 -04:00
Niko Matsakis
fad838a361 modify recursive ascent to expect (loc, enum, loc) when a location type
is specified, and modify test tokenizer to provide it
2015-07-17 09:07:30 -04:00
Niko Matsakis
7b31c3eed6 fix unit tests 2015-07-16 06:09:31 -04:00
Niko Matsakis
c92619fe15 implement associated types for extern tokens and track an (optional)
location type
2015-07-15 19:38:15 -04:00
Niko Matsakis
59de015817 tweak the escaping to actually be correctish 2015-07-15 13:31:50 -04:00
Niko Matsakis
a1da099572 various annoying things to get macros working 2015-07-15 09:35:24 -04:00
Niko Matsakis
bfe72e14fc Misc changes to make the expr-arena-ast test case work
(threading through type parameters etc)
2015-07-15 06:21:43 -04:00
Niko Matsakis
43995dd6cf convert state fns to use rust_fn_header 2015-07-15 05:14:50 -04:00
Niko Matsakis
ccf9320b10 introduce a write_fn_header fn and use it in a few places,
with the intention of making it possible to thread grammar parameters
through
2015-07-14 22:28:20 -04:00
Niko Matsakis
48bbe83c5e fix indenting :) 2015-07-14 12:49:39 -04:00
Niko Matsakis
8f14f9a3f3 structure to be more friendly to adding parameters 2015-07-14 12:48:54 -04:00
Niko Matsakis
0ee3ac81d6 add some more namespacing 2015-07-14 11:47:31 -04:00
Niko Matsakis
a4d2444950 add more prefixing, I think to all identifiers this time 2015-07-14 11:45:51 -04:00
Niko Matsakis
39a90bdd73 add some comments 2015-07-14 11:33:07 -04:00
Niko Matsakis
f346ce8a06 namespace tokens in generated code 2015-07-14 11:32:58 -04:00
Niko Matsakis
4cf8bd92f2 update tests to just write grammar; instead of grammar { },
avoiding pointless rightward drift
2015-07-12 09:09:33 -04:00
Niko Matsakis
1102b26390 Fix expr.lalropo 2015-07-12 09:04:24 -04:00
Niko Matsakis
4921ddbfc2 Port the LR(1) state construction code to use KernelSet,
which reveals that the assoc type direction is wrong,
it should be parameterized by the richer type of the Kernel
than by the index
2015-07-12 05:41:20 -04:00
Niko Matsakis
9b9a487802 add an error message for named symbols, it's not the best 2015-07-12 05:26:22 -04:00
Niko Matsakis
c3e4b7916d Simplify grammars more now that "Num" has proper type 2015-07-11 21:35:04 -04:00
Niko Matsakis
5c782c182e Fix lots of things, but the new pattern mechanism works -- we can match
and extract subbindings, and terminals no longer have uniform type. Very
nice.
2015-07-11 21:34:02 -04:00
Niko Matsakis
ae821645e9 change format of token declarations to extern token with an enum
section, paving the way for more advanced concepts; also, refactor Types
interface to make it possible to have different types depending on the
kind of terminal
2015-07-10 17:28:29 -04:00
Niko Matsakis
dfb787fa3e Use <> instead of ~~ to be consistent with < as the "select"
operator.
2015-07-10 09:23:33 -04:00
Niko Matsakis
23d204e6b2 Change from id:X to <id:X> 2015-07-07 06:22:06 -04:00