112 Commits

Author SHA1 Message Date
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
Niko Matsakis
350e46cc98 Change from ~X to <X> 2015-07-07 06:12:04 -04:00
Niko Matsakis
1a0c88f0bc modify parser so that Foo<Bar> is considered a macro invocation,
but `Foo <Bar>` is considered two distinct tokens
2015-07-07 05:47:36 -04:00
Niko Matsakis
909d1b0655 get all tests passing again after introducing validation step 2015-07-07 05:47:19 -04:00
Niko Matsakis
8fc9b609a4 fix error reporting in terms of spans etc (no automated tests for this, boo) 2015-07-03 13:14:38 -04:00
Niko Matsakis
1b46191fdc add validation an (incompletely utilized) unit testing framework, thread
spans through somewhat more
2015-07-02 15:31:43 -07:00
Niko Matsakis
dc9b6567ea thread spans through the parse-tree symbols, not sure why I didn't
do this in the first place
2015-07-02 13:15:37 -07:00
Niko Matsakis
48e3647748 make the DFA analyzer accept explicit precedences 2015-06-30 22:48:01 -07:00
Niko Matsakis
f85f133c3e combine the tests into one big executable so as to avoid having
to rebuild lalrpop once per test, and also avoid need to write a
makefile
2015-06-30 08:30:01 -07:00
Niko Matsakis
445c8e69ec introduce a dummy nonterminal for start symbols automatically 2015-06-30 08:05:15 -07:00
Niko Matsakis
dd83ec0cea reorganize lalrpop so that it is a library that can be added to
a project via build.rs, give a few examples of this in practice
2015-06-29 22:31:14 -07:00
Niko Matsakis
5e7dd66534 work on accepting parameters etc 2015-06-29 14:20:05 -07:00
Niko Matsakis
6192b0b2a1 refactor grammar to prevent undesirable nesting of symbols and
so forth
2015-06-25 22:39:11 -07:00
Niko Matsakis
388fbcb495 Sort and dedup lr1 states, fix a bunch of tests.
Change `~x:Foo` notation to just `x:Foo`
2015-06-24 07:17:55 -07:00
Niko Matsakis
fbc59064ef Update README 2015-06-24 06:03:57 -07:00
Niko Matsakis
d82b794bbe Move lalrpop code into a subdirectory 2015-06-24 05:53:24 -07:00
Niko Matsakis
79158121ec DFA is now basically working. 2015-06-23 22:14:23 -07:00
Niko Matsakis
73c1467590 add a few more tests 2015-06-23 14:58:37 -07:00
Niko Matsakis
74cb94a739 add testing for nfa 2015-06-23 14:54:36 -07:00
Niko Matsakis
9e6fc6df49 impl NFA/DFA conversion (untested) 2015-06-23 11:51:04 -07:00
Niko Matsakis
51e1f7eb67 Add a regular expression parser and NFA construction code 2015-06-23 09:23:11 -07:00
Niko Matsakis
4379b13c9d Make type inference smarter, based on the idea that all constraints must
have the same type; so if we see errors or cases where we cannot infer a
type, let's just take it from one of the successful alternatives. This
lets us remote the type annotation on `E` (or `T`, depending).
2015-06-22 14:14:03 -04:00
Niko Matsakis
2d53902a4f remove the name of the grammar, which wasn't really used for anything 2015-06-22 13:31:55 -04:00
Niko Matsakis
fc377940ed revamp a bit to lay groundwork for better patterns, make sub have actions 2015-06-22 13:08:38 -04:00
Niko Matsakis
1faf1d2841 Start extracting out a utility library with a tokenizer, main
fn, etc so I can write more tests
2015-06-22 09:42:19 -04:00
Niko Matsakis
411ff7a6d2 avoid emitting useless warnings 2015-06-22 08:57:43 -04:00