Commit Graph

228 Commits

Author SHA1 Message Date
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
Cheer Xiao
d55a79fd28 gofmt 2014-01-27 21:55:18 +08:00
Cheer Xiao
e0b3750022 Add parse/lex_test.go 2014-01-27 21:22:59 +08:00
Cheer Xiao
fad691a39a Add Node.Isomorph and implement for all instances 2014-01-27 20:35:50 +08:00
Cheer Xiao
5d266424d8 Clean up FactorNode, ditch "dollaring" 2014-01-27 20:12:48 +08:00
Cheer Xiao
5cf23e0895 cmd -> fm 2014-01-27 19:50:04 +08:00
Cheer Xiao
0ba0c23898 Name the application of commands "form", a la lisp 2014-01-27 19:43:03 +08:00
Cheer Xiao
67b5621e86 gofmt 2014-01-27 18:55:45 +08:00
Cheer Xiao
713f87fc9a Ditch relative imports, make this go get-able 2014-01-25 19:10:30 +08:00
Cheer Xiao
15898504ba Parse pipeline capture construct '(' Pipeline ')' 2014-01-21 22:43:46 +08:00
Cheer Xiao
29363b8186 gofmt 2014-01-16 09:24:14 +08:00
Cheer Xiao
ca50213cdb ClosureNode.Args -> .ArgNames 2013-11-19 18:39:16 +08:00
Cheer Xiao
9378104e4d Pipe now terminates a bareword 2013-11-19 12:06:03 +08:00
Cheer Xiao
6227008696 Abstract in-package panic/recover into a utility 2013-11-16 19:34:13 +08:00
Cheer Xiao
a18a1d1a1e Fix pipeline and chunk parsing. 2013-10-29 17:58:18 +08:00
Cheer Xiao
e25d47c6eb Make a parse.Redir also a parse.Node. 2013-10-29 17:51:56 +08:00
Cheer Xiao
13580e3ab9 parse: Expose TerminatesBare, add StartsBare 2013-10-29 10:54:06 +08:00
Cheer Xiao
a4511b875b CommandNode.{Name Args} should be *ListNode. 2013-10-28 21:07:47 +08:00
Cheer Xiao
cad72562f2 Parse command name separate from args. 2013-10-28 21:01:05 +08:00
Cheer Xiao
3cefe600f4 Update comment of FactorNode. 2013-10-28 20:45:30 +08:00
Cheer Xiao
041cb14aa9 Parse empty closures properly. 2013-10-28 20:32:27 +08:00
Cheer Xiao
84739ce9f0 Revert the block vs. closure difference. 2013-10-28 20:29:47 +08:00
Cheer Xiao
a59ae1b894 Use ampersand for key-value pair and closure literal. 2013-10-28 10:55:25 +08:00
Cheer Xiao
6a77d0902a Lex ampersand (&). 2013-10-28 10:38:25 +08:00
Cheer Xiao
ab01025087 Use braces to delimit flat lists, like sh. 2013-10-28 10:24:46 +08:00
Cheer Xiao
52b99c49e3 Remove bogus comment. 2013-10-28 10:14:15 +08:00
Cheer Xiao
8253d6af79 Parse closure (buggy). 2013-10-28 10:10:34 +08:00
Cheer Xiao
4c879492a9 Lex semicolon and parse chunks. 2013-10-22 17:46:12 +08:00
Cheer Xiao
1a5c404ae3 Lex braces. 2013-10-22 14:41:37 +08:00
Cheer Xiao
f261c7e853 Parser.stopParse should only zero p.lex. 2013-10-21 10:54:14 +08:00
Cheer Xiao
38d0a680ff parse.Tree -> Parser. 2013-10-18 22:14:21 +08:00
Cheer Xiao
c2fd203918 parse.Error -> util.ContextualError 2013-10-18 11:38:30 +08:00
Cheer Xiao
e1c96c6cfc Separate "util" package. 2013-10-18 09:46:06 +08:00
Cheer Xiao
8b8605ada8 Support explicit caret. 2013-10-17 21:11:09 +08:00
Cheer Xiao
c8a86d461d Slightly improve error msg. 2013-10-17 13:14:08 +08:00
Cheer Xiao
fd590fd4fb Use Item.String for user-friendly output, Item.GoString for debugging. 2013-10-17 10:45:18 +08:00
Cheer Xiao
f231eb92cf Forgot to commit parse/error.go; pretty print parse.Error. 2013-10-17 10:21:42 +08:00
Cheer Xiao
da38f38977 parse.parseError -> parse.Error; return *Error in Parse 2013-10-17 10:08:21 +08:00
Cheer Xiao
49b8cdda21 Move parse.parseError to separate file 2013-10-17 10:05:21 +08:00
Cheer Xiao
e95d8405a5 Implement ItemType.String(); report position info in parser 2013-10-17 09:59:44 +08:00
Cheer Xiao
3f025adf12 Revamp parsing error handling a bit 2013-10-16 21:54:07 +08:00
Cheer Xiao
4e0e514efd Update comments. 2013-10-16 21:30:19 +08:00
Cheer Xiao
fa32cf73a0 Parse pairs in table literal correctly. 2013-10-16 21:29:21 +08:00
Cheer Xiao
eab3858f4c Parse table literal. 2013-10-16 21:10:01 +08:00
Cheer Xiao
b41bc7b98c Cosmetics 2013-10-16 20:18:33 +08:00
Cheer Xiao
0ddb5067f8 parse: Refine factor parsing 2013-10-16 20:15:31 +08:00
Cheer Xiao
de83621184 parse: Lex brackets [ and ] 2013-10-15 11:02:28 +08:00
Cheer Xiao
7f543b1ea9 parse: Dollar terminates bareword 2013-10-07 13:59:22 +08:00
Cheer Xiao
7d0133b27d parse: Remove unused (and broken) code 2013-10-06 17:56:19 +08:00
Cheer Xiao
511448237e parse: Lex and parse dollar $ 2013-10-06 15:01:13 +08:00
Cheer Xiao
c925871ef4 parse: Always use *ListNode for Term's 2013-10-06 14:55:28 +08:00
Cheer Xiao
585e047ca5 parse: Introduce FactorNode to represent Factor 2013-10-06 14:27:00 +08:00
Cheer Xiao
84cdc6c50f parse: Remove outdated TODO 2013-10-06 13:07:45 +08:00
Cheer Xiao
e4db8e7d0d parse: Lex comments as ItemSpace (until we need fancier comment handling) 2013-10-06 10:45:16 +08:00
Cheer Xiao
7b20e5f45b parse: Fix unquoting of ItemSingleQuoted and termination of bareword
ItemSingleQuoted is now quoted with ` now.
2013-10-05 09:53:58 +08:00
Cheer Xiao
4a78397c7f parse: Lex (but not yet parse) ItemComment
Comments can only start at start of line or after spaces. Thus `echo a#`
doesn't have a comment.
2013-10-05 09:40:26 +08:00
Cheer Xiao
a4301d195f Parse and evaluate factor of term list
Note: the evaluation is currently a stub.
2013-10-05 00:19:40 +08:00
Cheer Xiao
b5319c9528 parse: Introduce ItemList node; allow empty pipeline 2013-10-05 00:11:28 +08:00
Cheer Xiao
755ff1a26e parse: Backquote is now used for single-quoting 2013-10-04 23:59:57 +08:00
Cheer Xiao
a24ad63573 parse: Terminate barewords at " ' too 2013-10-04 23:59:08 +08:00
Cheer Xiao
c9b29f6447 Implement parsing & evaluation of terms
What used to be terms are now just factors.
2013-10-04 23:57:49 +08:00
Cheer Xiao
9ea3d77043 parse: Document the grammar 2013-10-04 23:49:00 +08:00
Cheer Xiao
77342c2bd4 parse: Parse single-rune tokens more compactly 2013-10-04 23:25:30 +08:00
Cheer Xiao
1e0cebf749 parse: More compact use of switch/case 2013-10-04 23:21:14 +08:00
Cheer Xiao
257bb658e8 parse: Add tokens LParen and RParen 2013-10-04 23:18:52 +08:00
Cheer Xiao
a69cc93bec parse: Stricter rule for bareword termination 2013-10-04 23:15:17 +08:00
Cheer Xiao
e6f0375f64 Use uintptr for fd in IO redirections.
IO redirections use os module now, which uses uintptr for fd.
2013-09-19 18:11:01 +08:00
Cheer Xiao
f2d35b8c39 Evaluate pipeline. Pipes are not yet connected. 2013-09-19 13:20:55 +08:00
Cheer Xiao
9ba448c92d parse: Update comment 2013-09-18 19:47:38 +08:00
Cheer Xiao
8ec1a90f33 parse: Parse a pipeline
das only executes the first command now.
2013-09-18 19:46:34 +08:00
Cheer Xiao
fbb4e376b0 parse: Include name of item type in Item.String 2013-09-18 19:38:15 +08:00
Cheer Xiao
7c69e3b5b1 parse: Lex the pipe (not parsing it yet) 2013-09-18 19:34:03 +08:00
Cheer Xiao
21837bc0a3 parse: Remove unneeded NodeType 2013-09-18 19:20:22 +08:00
Cheer Xiao
18d1e9bf40 parse: Cleanup, docs 2013-09-18 19:14:13 +08:00
Cheer Xiao
7fb91a572a parse: Expose the chan inside Lexer; close chan after lexing ends 2013-09-18 18:03:17 +08:00
Cheer Xiao
4f931c52cb Simplify source tree 2013-09-18 16:40:47 +08:00