Commit Graph

225 Commits

Author SHA1 Message Date
Qi Xiao
3823161fab parse: fix broken parent of Redir.Dest; add test 2016-01-31 17:01:42 +01:00
Qi Xiao
c78fc6aa5b parse: addSep now infers begin itself 2016-01-31 16:51:32 +01:00
Qi Xiao
82e027e435 Exitus -> Error 2016-01-30 17:11:43 +01:00
Qi Xiao
651c5b76e7 parse: add package doc 2016-01-29 03:00:11 +01:00
Qi Xiao
00999a6de3 support backquotes for output capture 2016-01-29 01:56:34 +01:00
Qi Xiao
a92c371467 parse: the first char of variable name can now be anything 2016-01-27 21:22:47 +00:00
Qi Xiao
8ac6dce0e4 parse: make backup after a read of EOF behave correctly
This is done by introducing an "overEOF" count, so that when rd.next() == EOF,
rd.backup() does nothing. This behavior is needed for some incomplete inputs.
2016-01-26 14:54:24 +01:00
Qi Xiao
5c64fa16e0 parse: support comments 2016-01-25 21:57:31 +01:00
Qi Xiao
aedf2120f8 parse: Always return whatever has been parsed 2016-01-24 19:19:44 +01:00
Qi Xiao
4b2fbce4bc parse: Don't expose Node.N() 2016-01-24 19:04:15 +01:00
Qi Xiao
233a8f4b07 parse-ng -> parse 2016-01-24 18:15:21 +01:00
Qi Xiao
4f827d4c05 Remove parse 2016-01-24 18:15:20 +01:00
Cheer Xiao
4c53900be9 Remove unused struct 2015-07-06 20:02:41 +02:00
Cheer Xiao
7d632d2714 Remove ItemTypeCount 2015-02-27 02:36:53 +01:00
Cheer Xiao
c1ffe6d885 Use stringer to generate ItemType.String implementation 2015-02-27 02:35:39 +01:00
Cheer Xiao
900d814edb Move util/deepprint{"" _test}.go into print package
This fully eliminates the util package.
2015-02-26 17:10:37 +01:00
Cheer Xiao
060e9eeb62 Minor refactor on parse.RedirBase 2015-02-24 22:07:01 +01:00
Cheer Xiao
7de48274b1 Strip all parse.Node structs of the Node suffix 2015-02-24 21:59:14 +01:00
Cheer Xiao
2bce0c1fcb golint fixes for parse 2015-02-24 21:52:13 +01:00
Cheer Xiao
fd2e26700a Move error-related utilities from util to errutil 2015-02-09 12:28:36 +01:00
Cheer Xiao
b9dfd552b2 util.{Panic Recover} -> util.{Throw Catch} 2015-02-09 12:11:47 +01:00
Cheer Xiao
18380eedc7 Fix StartsBare to reject # and sigils 2015-01-23 00:40:05 +01:00
Cheer Xiao
b9cf419891 Degrade or reformat XXX's 2015-01-23 00:38:44 +01:00
Cheer Xiao
f76cc8854b Exclude = from sigils. 2015-01-22 20:24:16 +01:00
Cheer Xiao
a578fb1624 Add tests for {Chan Status}CapturePrimary 2015-01-20 21:27:21 +01:00
Cheer Xiao
c652fdcd9b Add closures to parse_test.go 2015-01-20 21:03:35 +01:00
Cheer Xiao
590154a955 Item of type ItemError now stringifies to "error: " + value 2015-01-20 20:45:23 +01:00
Cheer Xiao
44f8e23189 Handle parsing of empty chunks properly 2015-01-20 20:32:44 +01:00
Cheer Xiao
1ed20259e9 Add a "title" attribute to ContextualError 2015-01-20 20:22:20 +01:00
Cheer Xiao
3720fea28b Fix parsing of closure literals 2015-01-20 20:21:59 +01:00
Cheer Xiao
450d98a4fa Let Parser.unexpected report more detailed error 2015-01-20 14:24:38 +01:00
Cheer Xiao
69c4b2d6b5 Remove ClosureNode.Annotation 2015-01-20 14:18:41 +01:00
Cheer Xiao
1ad8fcaa1f **.go: xiaq/elvish -> elves/elvish 2014-10-29 20:50:10 +01:00
Cheer Xiao
63ef2bdb4c Fix a typo: Ambiguious -> Ambiguous
This fixes issue #37.
2014-10-08 11:36:39 +02:00
Cheer Xiao
d596a4f941 Call zero value of PrimaryType BadPrimary 2014-09-27 00:32:57 +02:00
Cheer Xiao
081ca989f1 Output capture is now called channel output capture.
Bytes output capture will be introduced with a different syntax.
2014-09-27 00:31:32 +02:00
Cheer Xiao
7776312341 parse: Add more test cases 2014-09-24 23:40:16 +02:00
Cheer Xiao
ace01172cc Add parse.newTablePair 2014-09-23 09:48:48 +02:00
Cheer Xiao
87a833626a parse: Leave the opening symbols to Parser.{table closure} 2014-09-23 09:48:41 +02:00
Cheer Xiao
e39856f483 Add a parse test case 2014-09-22 13:43:08 +02:00
Cheer Xiao
555b050120 parse: Add many test cases 2014-09-20 22:30:39 +02:00
Cheer Xiao
1511472335 parse/parse.go: Minor fixes 2014-09-20 22:30:28 +02:00
Cheer Xiao
61d720d20f parse/lex.go: '<' '>' '?' now also terminates a bareword 2014-09-20 21:52:55 +02:00
Cheer Xiao
da87dff8bd parse: redir is now RedirBase and its members are public
This is needed for util.DeepPrint used in test cases.
2014-09-20 21:50:01 +02:00
Cheer Xiao
09faecc159 parse/lex.go: Remove unused funcs 2014-09-20 20:50:43 +02:00
Cheer Xiao
a71327d64c A lone sigil is now treated as a bareword.
Issue #5 is now properly implemented.
2014-09-20 20:34:33 +02:00
Cheer Xiao
333f76de74 Implement sigil, as per issue #5.
However due to problems with user-defined functions this can not be tested
reliably yet.
2014-09-20 19:09:23 +02:00
Cheer Xiao
b5758d5cba parse: Improve comments 2014-09-20 15:29:07 +02:00
Cheer Xiao
403da6a37f Remove "caret" from the language.
Caret is an artifact from rc to support forms like `echo $a ^ b`. Since elvish
supports {the list syntax} this can be written as `echo {$a}b` like in fish.

The operation of compounding primary expressions is now properly called
"compound".
2014-09-20 15:06:16 +02:00
Cheer Xiao
4624bc5dc4 Enrich comments in parse/parse.go 2014-09-16 21:25:41 +02:00
Cheer Xiao
613ad85a96 Introduce Subscript between Compound and Primary
Subscription is no longer implemented as caret. As a result,
`set $a table = [foo]; echo bar$a[0]` now works as expected.
2014-09-16 21:12:46 +02:00
Cheer Xiao
2451dc0cf9 A term is now a compound expression. A term list is now a spaced expression. 2014-09-16 17:57:33 +02:00
Cheer Xiao
319e2d9274 A factor is now called a primary expression. 2014-09-04 17:17:10 +02:00
Cheer Xiao
a3c8ed4876 Instead of specialized parse.Context, just use the incomplete parse tree 2014-08-22 09:12:18 +02:00
Cheer Xiao
1606f1a662 Ensure len(ItemTypeNames) == number of valid ItemType values 2014-06-07 02:22:35 +08:00
Cheer Xiao
9efa26930e parse.go: Parse multiple pipelines properly 2014-06-07 02:19:41 +08:00
Cheer Xiao
9701941298 lex.go: Add missing ItemTypeNames elements 2014-06-04 11:26:12 +08:00
Cheer Xiao
a866ae6350 Eliminate {Pipeline Form}Node.Annotation 2014-05-22 13:01:28 +08:00
Cheer Xiao
b25e17fa26 Implement closure enclosure.
Scopes are now represented by map[string]*Value instead of map[string]Value,
allowing multiple scopes to share the same Value instance.
2014-03-30 10:32:06 +08:00
Cheer Xiao
5a21985874 Add a static checker, eval.Checker 2014-03-20 13:19:30 +08:00
Cheer Xiao
c3e9c77c13 Implement status capture factor ?(cmd1|cmd2) 2014-03-17 17:16:38 +08:00
Cheer Xiao
06b0098705 Status redir now uses ?>. Introduce ?( for status substitution 2014-03-17 17:07:38 +08:00
Cheer Xiao
31451c572a Lex, color and highlight the new status redir token >? 2014-03-17 11:23:32 +08:00
Cheer Xiao
3506642f04 parse: Get rid of ListNode 2014-03-11 18:28:56 +08:00
Cheer Xiao
c112096d22 Interface tag funcs cleanup 2014-02-10 21:10:04 +08:00
Cheer Xiao
42fcb8eb22 goimports 2014-02-10 11:33:53 +08:00
Cheer Xiao
db7eba2140 Improve XXX comments
Most are turned into `BUG(xiaq):`; the rest into `XXX(xiaq):`
2014-02-08 19:23:23 +08:00
Cheer Xiao
53ee02a15e Introduce parse.Term{List ``}Node 2014-02-08 19:06:31 +08:00
Cheer Xiao
d033efbf80 Use parse to find completion context 2014-02-07 22:46:27 +08:00
Cheer Xiao
c531bd3f2b parse: Fix p.Ctx.ThisFactor.Pos in case of empty term 2014-02-06 22:02:44 +08:00
Cheer Xiao
33027661ea parse: Fix TestComplete test cases 2014-02-06 22:00:59 +08:00
Cheer Xiao
6ee8167250 util.GoPrint -> .DeepPrint 2014-02-06 20:50:17 +08:00
Cheer Xiao
7aa992cc44 parse: Ditch Node.isomorph, use reflect.DeepEqual 2014-02-06 20:46:46 +08:00
Cheer Xiao
80200dcf4f Augment parse.Context even more
Comment out TestComplete test cases.
2014-02-06 20:08:40 +08:00
Cheer Xiao
b96138cb50 Node.Isomorph -> .isomorph 2014-01-31 19:37:33 +08:00
Cheer Xiao
939a622564 Document parse sources 2014-01-31 19:36:39 +08:00
Cheer Xiao
7d7814ef9b golint fixes 2014-01-31 19:18:10 +08:00
Cheer Xiao
67975bb536 Rethought parse.Context 2014-01-31 18:40:42 +08:00
Cheer Xiao
37d3d06f7b parse: Use panic/recover for yielding Context immediately 2014-01-31 11:12:13 +08:00
Cheer Xiao
e2a4d91441 parse_test.go: More robust TestParse 2014-01-31 11:12:00 +08:00
Cheer Xiao
364969d7e8 Update package docs 2014-01-30 22:17:38 +08:00
Cheer Xiao
ad90094ac6 Document util package 2014-01-30 22:04:16 +08:00
Cheer Xiao
95b0be333f NewFactorContext -> NewTermContext 2014-01-30 12:09:06 +08:00
Cheer Xiao
c7e0f06e69 Implement a broken way of completing... 2014-01-29 22:27:07 +08:00
Cheer Xiao
a9863199a5 parse/parse_test.go: Add (failing) TestComplete 2014-01-29 21:25:20 +08:00
Cheer Xiao
94dd2403a0 Add NewFactorContext 2014-01-29 21:24:23 +08:00
Cheer Xiao
72bafcae3d I always forget to gofmt... 2014-01-29 21:17:04 +08:00
Cheer Xiao
1f6c69ba88 Remove unused Parser.tab 2014-01-29 21:14:06 +08:00
Cheer Xiao
af6d874418 Add VariableNameContext 2014-01-29 21:12:14 +08:00
Cheer Xiao
28f803ae77 Simplify parse.Context 2014-01-29 21:09:17 +08:00
Cheer Xiao
f94ff879ef Add shorthand func parse.Complete 2014-01-29 20:45:56 +08:00
Cheer Xiao
c1711bbd0a Project rename: das -> elvish 2014-01-29 18:44:07 +08:00
Cheer Xiao
00d72427de Add parse/parse_test.go (very preliminary) 2014-01-28 14:40:31 +08:00
Cheer Xiao
de9ca5f79c gofmt 2014-01-28 14:39:26 +08:00
Cheer Xiao
b50b79ecc3 Fix two Node.Isomorph implementations 2014-01-28 14:38:08 +08:00
Cheer Xiao
9178e3d34c FormNode.Name -> .Command 2014-01-28 14:32:47 +08:00
Cheer Xiao
d4e7855895 Add a shorthand for constructing parse.ListNode 2014-01-28 14:26:15 +08:00
Cheer Xiao
2ee8efc1b4 Introduce shorthand function parse.Parse 2014-01-28 12:10:21 +08:00
Cheer Xiao
33643163a3 parse.Parser.parse no longer return itself 2014-01-28 12:01:30 +08:00
Cheer Xiao
5864354685 Add parse/strconv_test.go 2014-01-28 11:58:04 +08:00