ridiculousfish
c91f70523c
Rework error messages to be shorter and to handle more special bash-isms
...
Example: we can point $* to argv
Fixes #1288
2015-04-29 16:53:02 -07:00
ridiculousfish
39fe9fcfcd
Tweak comment handling. Mark a parse node with a new flag when it has comments
2014-12-23 10:58:45 -08:00
ridiculousfish
bf80b0db19
Fix to avoid generating multiple error nodes on parse error
2014-12-23 10:53:38 -08:00
ridiculousfish
ebfaa8cc95
Replace an expensive expand_one call with the cheaper unescape_string
...
Makes parsing a little faster
2014-12-23 10:08:41 -08:00
ridiculousfish
c31ad3ed07
Disallow backgrounding in conditionals and before and/or bool statements
...
Fixes #1136
2014-11-02 13:11:27 -08:00
ridiculousfish
7ac593273e
Remove a bunch of dead code identified by cppcheck
2014-10-31 01:15:50 -07:00
ridiculousfish
a529fc9d83
Set of fixes for issues identified by cppcheck
2014-10-30 22:40:35 -07:00
ridiculousfish
9e32b330aa
Unescape strings in keyword detection.
...
This allows keywords to be quoted. However, they may not contain
variable or process expansions, etc. Fixes #1398
2014-10-15 12:49:02 -07:00
ridiculousfish
ff7108877b
Use binary search to determine what tokens are keywords
2014-10-15 12:04:23 -07:00
ridiculousfish
1927ebbc5d
Improve error reporting for unclosed blocks
2014-10-14 00:41:39 -07:00
ridiculousfish
27dd37ebb4
Fix to indent comments in blocks properly ( #1710 )
...
This makes two changes to parse trees:
1. Unmaterialized nodes no longer have an invalid source location
For example, with the code `while false;end` there are no tokens
associated with the while loop's job_list, and therefore it is
unmaterialized. Previously it would have had a SOURCE_OFFSET_INVALID.
But now it has a zero source length, but an offset equal to the end of
the while loop (i.e. the semicolon), and a zero length. Correspondingly,
the has_source function now checks the length instead of the offset.
2. Special (comment and error) nodes have always been "disconnected,"
meaning they are not the child of any other node. However, they now have
their parent offsets set to whatever the top of the node stack was when
the node was encountered. This gives us a sense of which node the
comment is "in", e.g. if we are constructing a job list then the
comment's parent will be the job list. This lets us determine the
comment's indent.
2014-09-29 11:30:21 -07:00
ridiculousfish
16b982958b
Correctly complete redirections. Fixes #1296
2014-05-02 01:22:39 -07:00
ridiculousfish
58ebdd4a7e
Attempt to silence some warnings
2014-04-27 17:23:19 -07:00
ridiculousfish
0d3169ef70
Run restyle.sh to enforce style rules.
2014-03-31 10:01:39 -07:00
ridiculousfish
005edf71a8
Fix initially backgrounded jobs. Fixes #1373
2014-03-28 14:39:47 -07:00
ridiculousfish
42166be22e
Make the argument list parsing in complete -a robust against weird
...
tokens like &. Improve the error message when such tokens are found.
2014-03-27 11:34:18 -07:00
ridiculousfish
62b3ed17ba
Teach parser_t how to parse an argument list that contains newlines, for
...
complete -a support. Fixes #1369
2014-03-27 11:17:05 -07:00
ridiculousfish
f2a437bd3b
Merge branch 'master' into parser_cleanup
...
Conflicts:
parse_constants.h
parse_tree.h
2014-03-26 13:59:14 -07:00
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
ad6367018b
Excise use of parser_t's error() functionality. Thread a
...
parse_error_list_t through all of the expand functions, enabling them to
report errors more directly. Improve aspects of error reporting for
expansion failures.
2014-03-21 17:13:33 -07:00
ridiculousfish
e5ef45e4c0
Rewrite parser_t::test_args and parser_t::eval_args to use new parser
2014-03-20 21:32:02 -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