Commit Graph

57 Commits

Author SHA1 Message Date
ridiculousfish
c31ad3ed07 Disallow backgrounding in conditionals and before and/or bool statements
Fixes #1136
2014-11-02 13:11:27 -08:00
Kevin Ballard
cab115c8b9 Don't stop job execution on wildcard errors
Wildcard errors are only reported interactively, and they're also not
really errors. Commands with multiple wildcards would in fact continue
executing if at least one wildcard matched, which is quite surprising.
But they would report an error if there is only one wildcard in the
arguments list and the wildcard has no match, even if there are other
remaining arguments.

Given this inconsistency, and given that sh does not stop execution if a
wildcard fails to match, it seems better to allow execution to continue.
This is better from a scripting perspective anyway, as it means
constructs like `set -l paths foo/*.txt` will actually create the
variable (with an empty value) instead of skipping the `set`
altogether and perhaps causing subsequent code to read or modify a
global or universal variable.
2014-10-13 18:51:51 -07:00
Kevin Ballard
4568359e27 Remove some obsolete job flags
These flags were used by the old parser, but not by the new one.
2014-10-13 18:33:55 -07:00
Kevin Ballard
07e4170418 Suppress wildcard errors in functions
Wildcard errors are only supposed to reported when encountered during
interactive use. The old parser also suppressed them if `is_block` was
true. This was lost in the new parser. However, this also suppresses
errors generated from `begin; code_here; end` and other block
constructs.

Instead, check the parser block stack when we hit an error, and suppress
the error if there are any function calls / events / source invocations.
These all indicate that the code being executed came from somewhere
other than the commandline.
2014-10-13 17:49:26 -07:00
Kevin Ballard
0372cdbe7e Standardize unmatched wildcard errors
Unmatched wildcard errors during parsing are normally only reported when
run interactively. The switch command was unconditionally reporting them
anyway (and not setting the status to 124). Fix it so switch goes
through the same code path as everything else.
2014-10-13 17:27:56 -07:00
ridiculousfish
649c3f262d Don't complain if no errors occurred due to cancellation
Fixes #1166
2014-10-06 00:47:55 -07:00
ridiculousfish
b00cbae4b5 Fix for issue where comments are lost in function definitions
Fixes #1710
2014-09-27 17:32:54 -07:00
ridiculousfish
98297e5234 Teach while loops to not hang forever with no-execute
Fixes #1543
2014-07-11 11:28:10 -07:00
ridiculousfish
195cd130f8 Fix sense of test in parse_execution to issue a barrier if an external
command has run
2014-07-06 18:12:18 -07:00
ridiculousfish
32f5edc9c5 Do not continue execution if argument expansion fails. Fixes #1488 2014-05-31 12:41:27 -07:00
ridiculousfish
97c2ec8dcf Fix a duplicated variable, and defeat some warnings in fish_tests 2014-04-27 18:44:21 -07:00
ridiculousfish
b01d09d704 Set the job property of block_t before expanding arguments associated
with the job, fixing psub. Fixes #1394
2014-04-02 00:32:08 -07:00
ridiculousfish
0d3169ef70 Run restyle.sh to enforce style rules. 2014-03-31 10:01:39 -07:00
ridiculousfish
7248b2213d Fix switch statement syntax highlighting so that the arguemnt to switch
is colored as a parameter, not a command. Promote this from a tok_string
to a symbol_argument in the grammar too.
2014-03-28 17:09:08 -07:00
ridiculousfish
74b28f0a86 Fix for crash with malformed switch statement. Fixes #1376 2014-03-28 16:56:44 -07:00
ridiculousfish
005edf71a8 Fix initially backgrounded jobs. Fixes #1373 2014-03-28 14:39:47 -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
1305c02579 Rewrite parser_t::current_line() to respect new parser 2014-03-20 21:32:02 -07:00
ridiculousfish
3cfdc6d126 Fix line number reporting in new parser 2014-03-20 21:32:02 -07:00
ridiculousfish
cc12225142 Clean up various block types and state as part of new parser 2014-03-02 13:46:30 -08:00
ridiculousfish
d232a0f951 Implement status -n (line number) with new parser 2014-03-01 16:04:13 -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
bc43409624 Expand the variable name as an ordinary parameter in for loops. Added
test for it too.
2014-02-21 18:20:51 -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
29ddb68da4 Tests and fix to allow return to work correctly within if statements. Closes #1297. 2014-02-12 01:39:06 -08:00
ridiculousfish
414530c9c2 Partially rework profiling. Fix profiling crash with new parser. Fixes
1295
2014-02-09 14:04:43 -08:00
ridiculousfish
e632d39b1f Make if statements always return success at the end, matching other
shells. Fixes #1061.
2014-02-07 17:57:53 -08:00
ridiculousfish
bac3b39227 Highlight the entire variable name, not just the dollar sign. Fixes #1201 2014-02-03 14:16:00 -08:00
ridiculousfish
53814983ff Update style and formatting to conform to fish style guide. 2014-01-15 01:40:40 -08:00
ridiculousfish
6fc1d7dc77 Further cleanup and improvements to error messages 2014-01-13 03:57:59 -08:00
ridiculousfish
d9056081e7 Added tests for piping an fd other than stdout 2014-01-13 02:49:41 -08:00
ridiculousfish
25b25e3e49 Include missing algorithm header in parse_execution.cpp 2014-01-12 23:52:33 -08:00
ridiculousfish
0e9d159bc2 Improvements to error reporting. In particular, we now append a newline
in reader_shell_test, so that there's always a statement terminator.
Otherwise commands like 'echo |' would not be considered an error (just
incomplete).
2014-01-08 18:20:55 -08:00
ridiculousfish
b34721b3f4 Miscellaneous optimizations to reduce string copying 2014-01-07 14:57:58 -08:00
ridiculousfish
cb6be2a50d Support for "simple block" optimization, where we can run blocks
directly if there are no arguments or redirections to the block itself
2014-01-07 10:45:36 -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
993148552e Support for Ctrl-C cancellation in new parser. Added tests for it too. 2014-01-02 16:19:33 -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
7356a0f6c8 Clean up and rationalize error handling in parse_execution.cpp 2013-12-31 14:37:37 -08:00
ridiculousfish
a9787b769f Support for implicit cd, no-exec, and the exit builtin. All tests now
pass (!). Error reporting still unsteady.
2013-12-29 16:23:26 -08:00
ridiculousfish
a42711e31c Support for break/continue with new parser execution 2013-12-28 22:52:06 -08:00
ridiculousfish
c632307eaa Make eval_node_at_offset return an error indication instead of the exit
status of the last command
2013-12-28 16:33:26 -08:00
ridiculousfish
0f9de11a67 Fix issues related to redirections and block level IO with new parser 2013-12-28 16:18:38 -08:00