Commit graph

3617 commits

Author SHA1 Message Date
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
Konrad Borowski
b9394b9599 Rename __fish_complete_usb function. 2014-01-14 08:28:15 +01:00
ridiculousfish
290aae80e1 Merge of "ast" branch, providing fish with a unified parser, used for execution, syntax coloring, completions, abbreviations, etc. This also bestows fish with a formalized grammar, which is 'documented' in a comment in parse_tree.h.
The parser here is a LL(2) parser, which is handwritten (to avoid complicating the build process and to maintain good control over error reporting, thread safety, etc). Later it's worth exploring using parser generators (lemon, etc) or other tools to simplify things.

This commit enables the new parser for syntax highlighting, completions, and abbreviations. Syntax highlighting retains the old implementation (disabled), which will be removed shortly. There is also support for a new execution model, based on the new parser, but it is disabled by default (can be enabled by setting the fish_new_parser variable to 1).

There's also lots of new tests, and some machinery for selecting which tests to run.

After living on this commit for a while, we'll enable the new execution model by default, and then begin to tear down the machinery of the old one (the block types, builtin_end, the parser_t junk, etc.). After that we can pursue even more exotic execution models, like multithreaded ones.

(The branch name is really a misnomer - the tree here is a parse tree, or concrete syntax tree, not an abstract one.)

Fixes #557
2014-01-13 13:57:35 -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
eb28c710ba Improve the 'This command can not be used in a pipeline' message to
actually name the command
2014-01-13 12:51:09 -08:00
leafonsword
129d2f803a 新文件: share/completions/lsusb.fish
新文件:    share/functions/__fish_complete_usb.fish
2014-01-13 20:24:20 +01:00
Max Gonzih
71f6986dd6 Fix __fish_print_packages for rpm 2014-01-13 22:36:02 +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
95f87cdd56 Support for special && and || error messages in new parser 2014-01-13 02:24:11 -08:00
ridiculousfish
746cc4c10b Rename highlight_shell_magic to highlight_shell_new_parser 2014-01-13 00:31:25 -08:00
ridiculousfish
51c18e3f9a Turn off new parser for execution by default in preparation for merge
with trunk
2014-01-13 00:05:43 -08:00
ridiculousfish
25b25e3e49 Include missing algorithm header in parse_execution.cpp 2014-01-12 23:52:33 -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
40e223c12d Additional miscellaneous fixes based on cppcheck static analysis 2014-01-12 13:53:59 -08:00
ridiculousfish
b2c78dbd57 Fix for issue where we compute a default USER variable, but never set
its value.
2014-01-12 13:42:26 -08:00
ridiculousfish
89069fdaa4 Miscellaneous minor fixes based on cppcheck static analyzer 2014-01-12 13:33:35 -08:00
Alexander I.Grafov
75b02e1d27 Fixes issue #1234. Fish now parses system wide ssh configuration file in addition to user config. 2014-01-12 14:59:46 +05:30
ridiculousfish
1130e4782d Remove some unused defines 2014-01-12 00:11:29 -08:00
Konrad Borowski
2927514e68 Partially fix #1224.
It would be nice if this would work without this hack,
but until then, this has to work. Requires you to reinstall
the prompt using fish configuration system.
2014-01-10 21:33:50 +01: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
d69f408b14 Rename builtin parse to __fish_parse 2014-01-08 15:13:08 -08:00
ridiculousfish
e8d6c96c1e Merge branch 'master' into ast 2014-01-08 15:07:56 -08:00
ridiculousfish
041120aab4 Clean up and reduce memory allocations in string escaping 2014-01-08 15:06:40 -08:00
Сергей Романов
d20f45b949 fix two minor typos in tutorial 2014-01-08 20:09:32 +03:00
David Adam
02bd933c58 Add Alt+. as a default binding for history-token-search-backward
Closes #89.
2014-01-08 15:15:15 +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
Siteshwar Vashisht
8160c85e44 Updated makefile to install javascript files and partials 2014-01-04 10:32:33 +05:30
ridiculousfish
426f58aa61 Merge branch 'master' into ast 2014-01-03 18:12:29 -08:00
ridiculousfish
e0bfa1e422 Merge branch 'fish_config_angular' 2014-01-03 17:54:54 -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
b8079953d8 Fix for cross-test interference where cancellation from one test would
lead to failure in expansion test
2014-01-03 15:27:39 -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
1863be7be4 Fix some warnings 2014-01-01 15:49:41 -08:00
ridiculousfish
358145c4bd Merge branch 'master' into ast 2014-01-01 15:32:50 -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
e2da73bf4f Fix for issue where 'while |' would be incorrectly interpreted as a
"naked statement" causing a wonky error message
2013-12-31 16:38:15 -08:00
ridiculousfish
4402f73bf7 Improve error reporting for tokens ending with newlines 2013-12-31 16:37:15 -08:00
ridiculousfish
7356a0f6c8 Clean up and rationalize error handling in parse_execution.cpp 2013-12-31 14:37:37 -08:00
David Adam
1efb120248 __fish_complete_svn: remove GNU extension options
Continuation of https://github.com/fish-shell/fish-shell/pull/1195/.
Removes use of --delimiter and --fields with cut(1) as these are GNU
extensions.

Note that a number of completions use these options, but as they are
only for GNU/Linux-specific tools have remained unmodified.
2013-12-30 12:32:24 +08:00
Mandeep Sandhu
8078d29fda Fix completion bug for special fish characters.
Issue #1108: If there are special characters like '{' in the
completion suggestions, then we fail to parse it successfully
as we are passing an unescaped version of the character to
parser_t::eval_args(...).

This causes us to retun w/o completion suggestions.

This bug was discovered while implementing 'git stash' completion
as the suggestion contained strings like 'stash@\{0\}'.

Th fix is to properly escape the string before parsing it.
2013-12-30 12:20:44 +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