Commit Graph

67 Commits

Author SHA1 Message Date
ridiculousfish
9fece3fdf1 Space and time optimizations for parse_node_t. Reduced size from 48
bytes to 20 bytes.
2014-03-25 20:06:34 -07:00
ridiculousfish
b520a03c57 Prefer swap() member function to std::swap. We were hitting the
inefficient generic std::swap for some derived types.
2014-03-25 12:44:21 -07:00
ridiculousfish
390a49072d Reorganize keyword recognition in the parser to use a single table 2014-03-10 07:38:14 +08:00
ridiculousfish
8d6b0c8d76 Allow the caller to specify the goal node when parsing a string via the
new parser. This enables parsing either a job list or an argument list.
2014-03-04 02:54:08 -08:00
ridiculousfish
be33d3f2a4 Revert "Merge pull request #1317 from pullreq/cpp"
This reverts commit 74135c0600, reversing
changes made to 6d749789ce.

See discussion in #1317
2014-02-28 02:16:48 -08:00
Geoff Nixon
18dd6f58e3 Fixes .c -> .cpp in comments. For doxygen. 2014-02-27 06:23:40 -08:00
Geoff Nixon
ddcd2b0810 Dead stores 2014-02-27 06:23:40 -08:00
ridiculousfish
2e1024d275 Tweak error reporting in new parser to use fewer lines 2014-02-17 14:52:08 -08:00
ridiculousfish
1fbf633817 Reimplement exec parsing. Instead of special-casing exec as a command,
promote it to a decoration (like 'command' or 'builtin'). This makes tab
completion and syntax highlighting treat exec's first argument as a
command and is otherwise a nice simplification. Fixes #1300
2014-02-13 10:10:49 -08:00
ridiculousfish
fd10844c2b Unbreak C++11 due to narrowing; use non-conflicting declaration FISH_COLORS instead of COLORS; remove deprecated register type. 2014-02-05 19:23:13 -08:00
ridiculousfish
53814983ff Update style and formatting to conform to fish style guide. 2014-01-15 01:40:40 -08:00
ridiculousfish
9da3d890e4 Fix for indentation test failures 2014-01-15 00:07:25 -08:00
ridiculousfish
28c7094f5b Fix for issue where 'function' would not define a function if the
arguments came before its name. Fixes #1240
2014-01-14 02:29:53 -08:00
ridiculousfish
ff5e2746da Fix for issue in new parser where no error would be reported if the very
first token is an error. Fixes #1239.
2014-01-14 00:38:55 -08:00
ridiculousfish
dc8014562b Fix for issue where unterminated quotes would attempt to be executed,
instead of continuing edit onto the next line.
2014-01-14 00:02:18 -08:00
ridiculousfish
212eeaa77c Correctly report errors for 'and' and 'or' in pipelines with new parser 2014-01-13 13:19:58 -08:00
ridiculousfish
95f87cdd56 Support for special && and || error messages in new parser 2014-01-13 02:24:11 -08:00
ridiculousfish
096f850433 Eliminate class parse_t 2014-01-12 22:39:12 -08:00
ridiculousfish
ec469782c8 Improvements to error messages with new parser. In particular, "naked
builtins" now print their help (e.g. just 'while')
2014-01-12 15:10:59 -08:00
ridiculousfish
89069fdaa4 Miscellaneous minor fixes based on cppcheck static analyzer 2014-01-12 13:33:35 -08:00
ridiculousfish
45852f0497 Add a convenience method next_node_in_node_list which can be used for
iterating over lists in a parse tree
2014-01-05 15:23:42 -08:00
ridiculousfish
bf75731bbe Fix for wrong syntax highlighting in the face of tokenizer errors, e.g.
"echo 'hi"
2014-01-03 17:42:25 -08:00
ridiculousfish
c8eec109b2 Support in parse_dump_tree for "forests", which occur when there's a
parse error
2014-01-03 16:54:34 -08:00
ridiculousfish
fb882f0b69 Support for stack overflow and infinite recursion detection in new
parser
2014-01-01 15:29:56 -08:00
ridiculousfish
27cba56761 Further improvements to error reporting with new parser 2014-01-01 00:04:02 -08:00
ridiculousfish
4402f73bf7 Improve error reporting for tokens ending with newlines 2013-12-31 16:37:15 -08:00
ridiculousfish
6ce4b344e4 Hook up for statements, if statements, and function definition in new
parser
2013-12-27 01:38:43 -08:00
ridiculousfish
a6ca809a4e Fix for issue where last job_list in tree would have a -1 production_idx
because we never actually sent the terminal token type
2013-12-26 14:52:15 -08:00
ridiculousfish
b6af3e51ab Very early work in adopting new parser for actual execution of commands.
Not turned on yet.
2013-12-23 14:53:56 -08:00
ridiculousfish
3e9153d955 Clean up some error messages. Don't show the line in the error message
if it's the first line and we're interactive, since then it's obvious
2013-12-16 16:52:23 -08:00
ridiculousfish
5cf59de676 Finish rewriting detect_errors to use new parser. All tests now pass (!) 2013-12-12 18:18:07 -08:00
ridiculousfish
d5d9b9284a Initial work towards rewriting detect_errors to use new parser.
Low-level tests currently pass; high level tests fail.
2013-12-11 18:34:28 -08:00
ridiculousfish
383b6aabf5 Improve error reporting in new parser. Tests now pass. 2013-12-08 22:29:02 -08:00
ridiculousfish
7a3f5afee7 Initial work towars improved error reporting. Tests currently fail. 2013-12-08 21:54:06 -08:00
ridiculousfish
dd0cc5ed9f Rewriting indenting functionality to use new parser 2013-12-08 13:41:12 -08:00
ridiculousfish
2a1fd421bd Correctly detect unbalanced 'end' in syntax highlighting 2013-11-25 00:48:01 -08:00
ridiculousfish
b06e798373 Revert "Remove undefined behavior from parse_error()."
Per my understanding this is not undefined behavior. No ABI depends on the called function reading
variadic arguments, nor does any standard require it. So if this is crashing something else must be going
on.

This reverts commit 22d22f6aa8.
2013-10-16 01:25:47 -07:00
Konrad Borowski
22d22f6aa8 Remove undefined behavior from parse_error().
Having function that takes arbitrary number of arguments without
actually reading them is undefined behavior, as it could cause stack
to be in the corrupted state. Now arguments after token are parsed,
even if they aren't needed.

See also: http://asciinema.org/a/5904
2013-10-14 11:45:29 +02:00
ridiculousfish
ce857b0770 Syntax highlighting for file redirections 2013-10-13 16:58:40 -07:00
ridiculousfish
ddf98661e4 Adopt new parser in tab completions 2013-10-12 18:17:03 -07:00
ridiculousfish
ddec870d25 Rework decision process for whether to interpret keywords as structural
or as commands (for LL parser). Will allow 'builtin --' to parse as a
plain statement, instead of a decorated statement '--'
2013-10-12 02:46:49 -07:00
ridiculousfish
77e358a001 Support for parsing e.g. 'command --' as a plain statement, instead of
executing the command '--'.
2013-10-12 01:47:31 -07:00
ridiculousfish
5490f54d00 Make parse_t::parse a static method so we don't have to create lots of
useless parse_t objects
2013-10-12 01:17:55 -07:00
ridiculousfish
58447c147f Make the new parser LL(2). Support for correct handling of e.g. 'command
--help'
2013-10-09 20:37:07 -07:00
ridiculousfish
7b86b2e05a Adoption of new parser in abbreviations 2013-10-09 02:03:50 -07:00
ridiculousfish
c6eef16664 Autosuggestion adoption of new parser 2013-10-08 15:05:30 -07:00
ridiculousfish
4f718e83b3 Syntax highlighting now correctly handles cd 2013-10-07 03:56:09 -07:00
ridiculousfish
20ccda69f4 Command highlighting works 2013-10-07 01:04:37 -07:00
ridiculousfish
14741518a7 Command highlighting now works 2013-10-06 16:23:45 -07:00
ridiculousfish
e58b73179f More work on new parser 2013-08-11 00:35:00 -07:00