aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-01 20:33:26 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-01 20:33:26 -0800
commitb187125b636c14253d626e4c2470f89e192168cf (patch)
tree2bece4c85b78e4bd5cedbfb77e57b0e7fe850c91
parent84ea96f383d3713f750d39a74d7b8693275db25d (diff)
parentd232a0f9512d0e1b575235fdf4119a63353ecedd (diff)
Merge branch 'master' into parser_cleanup
-rw-r--r--Doxyfile2
-rw-r--r--builtin.cpp2
-rw-r--r--builtin_commandline.cpp2
-rw-r--r--builtin_complete.cpp6
-rw-r--r--builtin_jobs.cpp2
-rw-r--r--builtin_printf.cpp3
-rw-r--r--builtin_set.cpp2
-rw-r--r--builtin_test.cpp3
-rw-r--r--builtin_ulimit.cpp2
-rw-r--r--common.cpp8
-rw-r--r--complete.cpp2
-rw-r--r--env.cpp2
-rw-r--r--env_universal.cpp6
-rw-r--r--env_universal_common.cpp3
-rw-r--r--event.cpp2
-rw-r--r--exec.cpp2
-rw-r--r--expand.cpp2
-rw-r--r--fallback.cpp3
-rw-r--r--fish.cpp10
-rw-r--r--fish_indent.cpp8
-rw-r--r--fish_pager.cpp7
-rw-r--r--fish_tests.cpp2
-rw-r--r--fishd.cpp2
-rw-r--r--function.cpp2
-rw-r--r--highlight.cpp2
-rw-r--r--input.cpp2
-rw-r--r--input_common.cpp2
-rw-r--r--intern.cpp2
-rw-r--r--io.cpp2
-rw-r--r--iothread.cpp3
-rw-r--r--key_reader.cpp3
-rw-r--r--kill.cpp2
-rw-r--r--mimedb.cpp2
-rw-r--r--output.cpp2
-rw-r--r--pager.cpp14
-rw-r--r--parse_execution.cpp62
-rw-r--r--parse_execution.h10
-rw-r--r--parse_productions.cpp4
-rw-r--r--parse_tree.cpp4
-rw-r--r--parse_util.cpp2
-rw-r--r--parser.cpp19
-rw-r--r--parser_keywords.cpp2
-rw-r--r--path.cpp4
-rw-r--r--print_help.cpp3
-rw-r--r--proc.cpp5
-rw-r--r--reader.cpp2
-rw-r--r--sanity.cpp2
-rw-r--r--screen.cpp3
-rw-r--r--share/doxygen_sqlite3.dbbin13312 -> 0 bytes
-rw-r--r--signal.cpp4
-rw-r--r--tests/test9.in5
-rw-r--r--tests/test9.out3
-rw-r--r--tokenizer.cpp2
-rw-r--r--util.cpp2
-rw-r--r--wgetopt.cpp2
-rw-r--r--wildcard.cpp2
-rw-r--r--wutil.cpp2
-rw-r--r--xdgmime.cpp3
-rw-r--r--xdgmimealias.cpp4
-rw-r--r--xdgmimeglob.cpp4
-rw-r--r--xdgmimeint.cpp5
-rw-r--r--xdgmimemagic.cpp3
-rw-r--r--xdgmimeparent.cpp2
63 files changed, 182 insertions, 104 deletions
diff --git a/Doxyfile b/Doxyfile
index 57bd35ef..d25badb9 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -422,7 +422,7 @@ INPUT =
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-FILE_PATTERNS = *.h *.cpp
+FILE_PATTERNS = *.h *.c
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
diff --git a/builtin.cpp b/builtin.cpp
index 947276e2..8b8b8d5c 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -1,4 +1,4 @@
-/** \file builtin.cpp
+/** \file builtin.c
Functions for executing builtin functions.
How to add a new builtin function:
diff --git a/builtin_commandline.cpp b/builtin_commandline.cpp
index 1dac978d..564eee7b 100644
--- a/builtin_commandline.cpp
+++ b/builtin_commandline.cpp
@@ -1,4 +1,4 @@
-/** \file builtin_commandline.cpp Functions defining the commandline builtin
+/** \file builtin_commandline.c Functions defining the commandline builtin
Functions used for implementing the commandline builtin.
diff --git a/builtin_complete.cpp b/builtin_complete.cpp
index ea69fa30..6e395f94 100644
--- a/builtin_complete.cpp
+++ b/builtin_complete.cpp
@@ -1,4 +1,4 @@
-/** \file builtin_complete.cpp Functions defining the complete builtin
+/** \file builtin_complete.c Functions defining the complete builtin
Functions used for implementing the complete builtin.
@@ -279,8 +279,8 @@ const wchar_t *builtin_complete_get_temporary_buffer()
/**
The complete builtin. Used for specifying programmable
- tab-completions. Calls the functions in complete.cpp for any heavy
- lifting. Defined in builtin_complete.cpp
+ tab-completions. Calls the functions in complete.c for any heavy
+ lifting. Defined in builtin_complete.c
*/
static int builtin_complete(parser_t &parser, wchar_t **argv)
{
diff --git a/builtin_jobs.cpp b/builtin_jobs.cpp
index a21aeafc..c6ca7713 100644
--- a/builtin_jobs.cpp
+++ b/builtin_jobs.cpp
@@ -1,4 +1,4 @@
-/** \file builtin_jobs.cpp
+/** \file builtin_jobs.c
Functions for executing the jobs builtin.
*/
#include "config.h"
diff --git a/builtin_printf.cpp b/builtin_printf.cpp
index 92be1a96..1a1ab335 100644
--- a/builtin_printf.cpp
+++ b/builtin_printf.cpp
@@ -1,6 +1,3 @@
-/** \file builtin_printf.cpp
-*/
-
/* printf - format and print data
Copyright (C) 1990-2007 Free Software Foundation, Inc.
diff --git a/builtin_set.cpp b/builtin_set.cpp
index 399b7e82..63341649 100644
--- a/builtin_set.cpp
+++ b/builtin_set.cpp
@@ -1,4 +1,4 @@
-/** \file builtin_set.cpp Functions defining the set builtin
+/** \file builtin_set.c Functions defining the set builtin
Functions used for implementing the set builtin.
diff --git a/builtin_test.cpp b/builtin_test.cpp
index 6a353029..0d16823a 100644
--- a/builtin_test.cpp
+++ b/builtin_test.cpp
@@ -646,11 +646,13 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
expression *result = parser.parse_expression(0, (unsigned int)args.size());
/* Handle errors */
+ bool errored = false;
for (size_t i = 0; i < parser.errors.size(); i++)
{
err.append(L"test: ");
err.append(parser.errors.at(i));
err.push_back(L'\n');
+ errored = true;
// For now we only show the first error
break;
}
@@ -665,6 +667,7 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
{
append_format(err, L"test: unexpected argument at index %lu: '%ls'\n", (unsigned long)result->range.end, args.at(result->range.end).c_str());
}
+ errored = true;
delete result;
result = NULL;
diff --git a/builtin_ulimit.cpp b/builtin_ulimit.cpp
index 7a0731f1..37bebd61 100644
--- a/builtin_ulimit.cpp
+++ b/builtin_ulimit.cpp
@@ -1,4 +1,4 @@
-/** \file builtin_ulimit.cpp Functions defining the ulimit builtin
+/** \file builtin_ulimit.c Functions defining the ulimit builtin
Functions used for implementing the ulimit builtin.
diff --git a/common.cpp b/common.cpp
index 6e216009..08e8d7a1 100644
--- a/common.cpp
+++ b/common.cpp
@@ -1,4 +1,4 @@
-/** \file common.cpp
+/** \file common.c
Various functions, mostly string utilities, that are used by most
parts of fish.
@@ -866,7 +866,11 @@ void write_screen(const wcstring &msg, wcstring &buff)
/*
If token is zero character long, we don't do anything
*/
- if (overflow)
+ if (pos == start)
+ {
+ start = pos = pos+1;
+ }
+ else if (overflow)
{
/*
In case of overflow, we print a newline, except if we already are at position 0
diff --git a/complete.cpp b/complete.cpp
index aee35bbd..9b8d5c0b 100644
--- a/complete.cpp
+++ b/complete.cpp
@@ -1,4 +1,4 @@
-/** \file complete.cpp Functions related to tab-completion.
+/** \file complete.c Functions related to tab-completion.
These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion.
*/
diff --git a/env.cpp b/env.cpp
index 074e3d1a..ab7f63e5 100644
--- a/env.cpp
+++ b/env.cpp
@@ -1,4 +1,4 @@
-/** \file env.cpp
+/** \file env.c
Functions for setting and getting environment variables.
*/
#include "config.h"
diff --git a/env_universal.cpp b/env_universal.cpp
index 7e2a0970..72e9cc0e 100644
--- a/env_universal.cpp
+++ b/env_universal.cpp
@@ -1,9 +1,3 @@
-/** \file env_universal.cpp
-
-Various functions, mostly string utilities, that are used by most
-parts of fish.
-*/
-
#include "config.h"
diff --git a/env_universal_common.cpp b/env_universal_common.cpp
index 2b54a3bc..dbf79c1a 100644
--- a/env_universal_common.cpp
+++ b/env_universal_common.cpp
@@ -1,4 +1,5 @@
-/** \file env_universal_common.cpp
+/**
+ \file env_universal_common.c
The utility library for universal variables. Used both by the
client library and by the daemon.
diff --git a/event.cpp b/event.cpp
index 85cd5f97..65d337f0 100644
--- a/event.cpp
+++ b/event.cpp
@@ -1,4 +1,4 @@
-/** \file event.cpp
+/** \file event.c
Functions for handling event triggers
diff --git a/exec.cpp b/exec.cpp
index 12458a51..832c8884 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -1,4 +1,4 @@
-/** \file exec.cpp
+/** \file exec.c
Functions for executing a program.
Some of the code in this file is based on code from the Glibc
diff --git a/expand.cpp b/expand.cpp
index d087559d..cd7194a3 100644
--- a/expand.cpp
+++ b/expand.cpp
@@ -1,4 +1,4 @@
-/**\file expand.cpp
+/**\file expand.c
String expansion functions. These functions perform several kinds of
parameter expansion.
diff --git a/fallback.cpp b/fallback.cpp
index 48a6a220..d26907e2 100644
--- a/fallback.cpp
+++ b/fallback.cpp
@@ -1,5 +1,4 @@
-/** \file fallback.cpp
-
+/**
This file only contains fallback implementations of functions which
have been found to be missing or broken by the configuration
scripts.
diff --git a/fish.cpp b/fish.cpp
index 21c9cb3f..35b641ee 100644
--- a/fish.cpp
+++ b/fish.cpp
@@ -1,6 +1,3 @@
-/** \file fish.cpp
- The main loop of fish.
-*/
/*
Copyright (C) 2005-2008 Axel Liljencrantz
@@ -18,6 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
+/** \file fish.c
+ The main loop of <tt>fish</tt>.
+*/
+
#include "config.h"
@@ -211,6 +213,8 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
paths.sysconf = L"" SYSCONFDIR "/fish";
paths.doc = L"" DOCDIR;
paths.bin = L"" BINDIR;
+
+ done = true;
}
return paths;
diff --git a/fish_indent.cpp b/fish_indent.cpp
index ec668a83..4560bb96 100644
--- a/fish_indent.cpp
+++ b/fish_indent.cpp
@@ -1,6 +1,3 @@
-/** \file fish_indent.cpp
- The fish_indent proegram.
-*/
/*
Copyright (C) 2005-2008 Axel Liljencrantz
@@ -18,6 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
+/** \file fish_indent.cpp
+ The fish_indent proegram.
+*/
+
#include "config.h"
#include <stdlib.h>
diff --git a/fish_pager.cpp b/fish_pager.cpp
index f0103be3..f640e995 100644
--- a/fish_pager.cpp
+++ b/fish_pager.cpp
@@ -1,7 +1,3 @@
-/** \file fish_pager.cpp
-*/
-
-
#include "config.h"
#include <stdlib.h>
@@ -443,6 +439,9 @@ static void completion_print_item(const wchar_t *prefix, comp_t *c, int width, b
writech(L' ');
}
set_color(get_color(HIGHLIGHT_PAGER_DESCRIPTION), bg);
+ written += print_max(L"(", 1, 0);
+ written += print_max(c->desc.c_str(), desc_width, 0);
+ written += print_max(L")", 1, 0);
}
else
{
diff --git a/fish_tests.cpp b/fish_tests.cpp
index 6494c6d3..7e82193c 100644
--- a/fish_tests.cpp
+++ b/fish_tests.cpp
@@ -1,4 +1,4 @@
-/** \file fish_tests.cpp
+/** \file fish_tests.c
Various bug and feature tests. Compiled and run by make test.
*/
diff --git a/fishd.cpp b/fishd.cpp
index 57f04a0f..30ded3cd 100644
--- a/fishd.cpp
+++ b/fishd.cpp
@@ -1,4 +1,4 @@
-/** \file fishd.cpp
+/** \file fishd.c
The universal variable server. fishd is automatically started by fish
if a fishd server isn't already running. fishd reads any saved
diff --git a/function.cpp b/function.cpp
index e58652c1..8421a4da 100644
--- a/function.cpp
+++ b/function.cpp
@@ -1,4 +1,4 @@
-/** \file function.cpp
+/** \file function.c
Prototypes for functions for storing and retrieving function
information. These functions also take care of autoloading
diff --git a/highlight.cpp b/highlight.cpp
index 21694884..eaaec750 100644
--- a/highlight.cpp
+++ b/highlight.cpp
@@ -1,4 +1,4 @@
-/** \file highlight.cpp
+/** \file highlight.c
Functions for syntax highlighting
*/
#include "config.h"
diff --git a/input.cpp b/input.cpp
index f08a18bb..93c73d46 100644
--- a/input.cpp
+++ b/input.cpp
@@ -1,4 +1,4 @@
-/** \file input.cpp
+/** \file input.c
Functions for reading a character of input from stdin.
diff --git a/input_common.cpp b/input_common.cpp
index c9a2afbf..d26f30b9 100644
--- a/input_common.cpp
+++ b/input_common.cpp
@@ -1,4 +1,4 @@
-/** \file input_common.cpp
+/** \file input_common.c
Implementation file for the low level input library
diff --git a/intern.cpp b/intern.cpp
index 4cb2994f..56dec21a 100644
--- a/intern.cpp
+++ b/intern.cpp
@@ -1,4 +1,4 @@
-/** \file intern.cpp
+/** \file intern.c
Library for pooling common strings
diff --git a/io.cpp b/io.cpp
index 11b5cd68..3395942c 100644
--- a/io.cpp
+++ b/io.cpp
@@ -1,4 +1,4 @@
-/** \file io.cpp
+/** \file io.c
Utilities for io redirection.
diff --git a/iothread.cpp b/iothread.cpp
index dbdff7dd..73646792 100644
--- a/iothread.cpp
+++ b/iothread.cpp
@@ -1,6 +1,3 @@
-/** \file iothread.cpp
-*/
-
#include "config.h"
#include "iothread.h"
#include "common.h"
diff --git a/key_reader.cpp b/key_reader.cpp
index 74347ba8..fae6f33f 100644
--- a/key_reader.cpp
+++ b/key_reader.cpp
@@ -1,5 +1,4 @@
-/** \file key_reader.cpp
-
+/*
A small utility to print the resulting key codes from pressing a
key. Servers the same function as hitting ^V in bash, but I prefer
the way key_reader works.
diff --git a/kill.cpp b/kill.cpp
index e7bf7ea4..6ae27c51 100644
--- a/kill.cpp
+++ b/kill.cpp
@@ -1,4 +1,4 @@
-/** \file kill.cpp
+/** \file kill.c
The killring.
Works like the killring in emacs and readline. The killring is cut
diff --git a/mimedb.cpp b/mimedb.cpp
index fa1ab400..fdf5da12 100644
--- a/mimedb.cpp
+++ b/mimedb.cpp
@@ -1,4 +1,4 @@
-/** \file mimedb.cpp
+/** \file mimedb.c
mimedb is a program for checking the mimetype, description and
default action associated with a file or mimetype. It uses the
diff --git a/output.cpp b/output.cpp
index df508a44..1f92c32e 100644
--- a/output.cpp
+++ b/output.cpp
@@ -1,4 +1,4 @@
-/** \file output.cpp
+/** \file output.c
Generic output functions
*/
diff --git a/pager.cpp b/pager.cpp
index 4fbed638..b137bca2 100644
--- a/pager.cpp
+++ b/pager.cpp
@@ -1,7 +1,3 @@
-/** \file pager.cpp
-*/
-
-
#include "config.h"
#include "pager.h"
@@ -149,6 +145,9 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s
{
written += print_max(L" ", packed_color, 1, false, &line_data);
}
+ written += print_max(L"(", packed_color, 1, false, &line_data);
+ written += print_max(c->desc, packed_color, desc_width, false, &line_data);
+ written += print_max(L")", packed_color, 1, false, &line_data);
}
else
{
@@ -632,6 +631,11 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co
{
search_field_text.append(PAGER_SEARCH_FIELD_WIDTH - search_field_text.size(), L' ');
}
+ line_t *search_field = &rendering->screen_data.insert_line_at_index(0);
+
+ /* We limit the width to term_width - 1 */
+ int search_field_written = print_max(SEARCH_FIELD_PROMPT, highlight_spec_normal, term_width - 1, false, search_field);
+ search_field_written += print_max(search_field_text, highlight_modifier_force_underline, term_width - search_field_written - 1, false, search_field);
}
}
@@ -743,7 +747,7 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
}
/* Ok, we had something selected already. Select something different. */
- size_t new_selected_completion_idx;
+ size_t new_selected_completion_idx = selected_completion_idx;
if (! selection_direction_is_cardinal(direction))
{
/* Next, previous, or deselect, all easy */
diff --git a/parse_execution.cpp b/parse_execution.cpp
index 13fbf0bb..15c7de5f 100644
--- a/parse_execution.cpp
+++ b/parse_execution.cpp
@@ -50,7 +50,7 @@ static wcstring profiling_cmd_name_for_redirectable_block(const parse_node_t &no
return result;
}
-parse_execution_context_t::parse_execution_context_t(const parse_node_tree_t &t, const wcstring &s, parser_t *p, int initial_eval_level) : tree(t), src(s), parser(p), eval_level(initial_eval_level)
+parse_execution_context_t::parse_execution_context_t(const parse_node_tree_t &t, const wcstring &s, parser_t *p, int initial_eval_level) : tree(t), src(s), parser(p), eval_level(initial_eval_level), executing_node_idx(NODE_OFFSET_INVALID), cached_lineno_offset(0), cached_lineno_count(0)
{
}
@@ -506,6 +506,7 @@ parse_execution_result_t parse_execution_context_t::run_for_statement(const pars
parse_execution_result_t parse_execution_context_t::run_switch_statement(const parse_node_t &statement)
{
assert(statement.type == symbol_switch_statement);
+ parse_execution_result_t ret = parse_execution_success;
const parse_node_t *matching_case_item = NULL;
parse_execution_result_t result = parse_execution_success;
@@ -531,6 +532,7 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement(const p
{
/* Store the node that failed to expand */
report_error(switch_value_node, WILDCARD_ERR_MSG, switch_value.c_str());
+ ret = parse_execution_errored;
break;
}
@@ -1300,6 +1302,9 @@ parse_execution_result_t parse_execution_context_t::run_1_job(const parse_node_t
/* Increment the eval_level for the duration of this command */
scoped_push<int> saved_eval_level(&eval_level, eval_level + 1);
+
+ /* Save the node index */
+ scoped_push<node_offset_t> saved_node_offset(&executing_node_idx, this->get_offset(job_node));
/* Profiling support */
long long start_time = 0, parse_time = 0, exec_time = 0;
@@ -1523,3 +1528,58 @@ parse_execution_result_t parse_execution_context_t::eval_node_at_offset(node_off
return status;
}
+
+int parse_execution_context_t::get_current_line_number()
+{
+ /* If we're not executing anything, return -1 */
+ if (this->executing_node_idx == NODE_OFFSET_INVALID)
+ {
+ return -1;
+ }
+
+ /* If for some reason we're executing a node without source, return -1 */
+ const parse_node_t &node = tree.at(this->executing_node_idx);
+ if (! node.has_source())
+ {
+ return -1;
+ }
+
+ /* Count the number of newlines, leveraging our cache */
+ const size_t offset = tree.at(this->executing_node_idx).source_start;
+ assert(offset <= src.size());
+
+ /* Easy hack to handle 0 */
+ if (offset == 0)
+ {
+ return 1;
+ }
+
+ /* We want to return (one plus) the number of newlines at offsets less than the given offset. cached_lineno_count is the number of newlines at indexes less than cached_lineno_offset. */
+ const wchar_t *str = src.c_str();
+ if (offset > cached_lineno_offset)
+ {
+ size_t i;
+ for (i = cached_lineno_offset; str[i] != L'\0' && i < offset; i++)
+ {
+ /* Add one for every newline we find in the range [cached_lineno_offset, offset) */
+ if (str[i] == L'\n')
+ {
+ cached_lineno_count++;
+ }
+ }
+ cached_lineno_offset = i; //note: i, not offset, in case offset is beyond the length of the string
+ }
+ else if (offset < cached_lineno_offset)
+ {
+ /* Subtract one for every newline we find in the range [offset, cached_lineno_offset) */
+ for (size_t i = offset; i < cached_lineno_offset; i++)
+ {
+ if (str[i] == L'\n')
+ {
+ cached_lineno_count--;
+ }
+ }
+ cached_lineno_offset = offset;
+ }
+ return cached_lineno_count + 1;
+}
diff --git a/parse_execution.h b/parse_execution.h
index 8ab5c5d6..91c32c99 100644
--- a/parse_execution.h
+++ b/parse_execution.h
@@ -39,6 +39,13 @@ private:
//parse_error_list_t errors;
int eval_level;
+
+ /* The currently executing node index, used to indicate the line number */
+ node_offset_t executing_node_idx;
+
+ /* Cached line number information */
+ size_t cached_lineno_offset;
+ int cached_lineno_count;
/* No copying allowed */
parse_execution_context_t(const parse_execution_context_t&);
@@ -105,6 +112,9 @@ public:
/* Returns the current eval level */
int current_eval_level() const { return eval_level; }
+
+ /* Returns the current line number. Not const since it touches cached_lineno_offset */
+ int get_current_line_number();
/* Start executing at the given node offset. Returns 0 if there was no error, 1 if there was an error */
parse_execution_result_t eval_node_at_offset(node_offset_t offset, const block_t *associated_block, const io_chain_t &io);
diff --git a/parse_productions.cpp b/parse_productions.cpp
index d071be09..d559a0d9 100644
--- a/parse_productions.cpp
+++ b/parse_productions.cpp
@@ -1,7 +1,3 @@
-/** \file parse_productions.cpp
-*/
-
-
#include "parse_productions.h"
using namespace parse_productions;
diff --git a/parse_tree.cpp b/parse_tree.cpp
index 9a174c73..484b7968 100644
--- a/parse_tree.cpp
+++ b/parse_tree.cpp
@@ -1,6 +1,3 @@
-/** \file parse_tree.cpp
-*/
-
#include "parse_productions.h"
#include "tokenizer.h"
#include "fallback.h"
@@ -990,6 +987,7 @@ void parse_ll_t::accept_tokens(parse_token_t token1, parse_token_t token2)
{
fprintf(stderr, "Consumed token %ls\n", token1.describe().c_str());
}
+ consumed = true;
break;
}
diff --git a/parse_util.cpp b/parse_util.cpp
index 4802d7cc..230a328c 100644
--- a/parse_util.cpp
+++ b/parse_util.cpp
@@ -1,4 +1,4 @@
-/** \file parse_util.cpp
+/** \file parse_util.c
Various mostly unrelated utility functions related to parsing,
loading and evaluating fish code.
diff --git a/parser.cpp b/parser.cpp
index adfa263a..de1a635a 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -1,4 +1,4 @@
-/** \file parser.cpp
+/** \file parser.c
The fish parser. Contains functions for parsing and evaluating code.
@@ -826,6 +826,16 @@ const wchar_t *parser_t::is_function() const
int parser_t::get_lineno() const
{
+ if (parser_use_ast())
+ {
+ int lineno = -1;
+ if (! execution_contexts.empty())
+ {
+ lineno = execution_contexts.back()->get_current_line_number();
+ }
+ return lineno;
+ }
+
int lineno;
if (! current_tokenizer || ! tok_string(current_tokenizer))
@@ -1162,6 +1172,13 @@ int parser_t::eval_new_parser(const wcstring &cmd, const io_chain_t &io, enum bl
parse_execution_context_t *ctx = new parse_execution_context_t(tree, cmd, this, exec_eval_level);
execution_contexts.push_back(ctx);
+ /* Execute the first node */
+ int result = 1;
+ if (! tree.empty())
+ {
+ result = this->eval_block_node(0, io, block_type);
+ }
+
/* Clean up the execution context stack */
assert(! execution_contexts.empty() && execution_contexts.back() == ctx);
execution_contexts.pop_back();
diff --git a/parser_keywords.cpp b/parser_keywords.cpp
index 801cc3c8..8aacd806 100644
--- a/parser_keywords.cpp
+++ b/parser_keywords.cpp
@@ -1,4 +1,4 @@
-/** \file parser_keywords.cpp
+/** \file parser_keywords.c
Functions having to do with parser keywords, like testing if a function is a block command.
*/
diff --git a/path.cpp b/path.cpp
index da550c7b..a2912f7b 100644
--- a/path.cpp
+++ b/path.cpp
@@ -1,7 +1,3 @@
-/** \file path.cpp
-*/
-
-
#include "config.h"
#include <stdlib.h>
diff --git a/print_help.cpp b/print_help.cpp
index 965de7ec..06bed30c 100644
--- a/print_help.cpp
+++ b/print_help.cpp
@@ -1,4 +1,5 @@
-/** \file print_help.cpp
+
+/** \file print_help.c
Print help message for the specified command
*/
diff --git a/proc.cpp b/proc.cpp
index b6b250a7..2ea0d1bd 100644
--- a/proc.cpp
+++ b/proc.cpp
@@ -1,4 +1,4 @@
-/** \file proc.cpp
+/** \file proc.c
Utilities for keeping track of jobs, processes and subshells, as
well as signal handling functions for tracking children. These
@@ -383,6 +383,8 @@ static void mark_process_status(const job_t *j, process_t *p, int status)
}
else
{
+ ssize_t ignore;
+
/* This should never be reached */
p->completed = 1;
@@ -396,6 +398,7 @@ static void mark_process_status(const job_t *j, process_t *p, int status)
handler. If things aren't working properly, it's safer to
give up.
*/
+ ignore = write(2, mess, strlen(mess));
}
}
diff --git a/reader.cpp b/reader.cpp
index 42e23e15..250884ff 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -1,4 +1,4 @@
-/** \file reader.cpp
+/** \file reader.c
Functions for reading data from stdin and passing to the
parser. If stdin is a keyboard, it supplies a killring, history,
diff --git a/sanity.cpp b/sanity.cpp
index 6d5a9087..f8976941 100644
--- a/sanity.cpp
+++ b/sanity.cpp
@@ -1,4 +1,4 @@
-/** \file sanity.cpp
+/** \file sanity.c
Functions for performing sanity checks on the program state
*/
#include "config.h"
diff --git a/screen.cpp b/screen.cpp
index d4da5b6b..7c02c384 100644
--- a/screen.cpp
+++ b/screen.cpp
@@ -1,4 +1,4 @@
-/** \file screen.cpp High level library for handling the terminal screen
+/** \file screen.c High level library for handling the terminal screen
The screen library allows the interactive reader to write its
output to screen efficiently by keeping an internal representation
@@ -298,6 +298,7 @@ size_t escape_code_length(const wchar_t *code)
if (code[1] >= L'@' && code[1] <= L'_')
{
resulting_length = 2;
+ found = true;
}
}
diff --git a/share/doxygen_sqlite3.db b/share/doxygen_sqlite3.db
deleted file mode 100644
index 0efa2bc7..00000000
--- a/share/doxygen_sqlite3.db
+++ /dev/null
Binary files differ
diff --git a/signal.cpp b/signal.cpp
index d4a8d1b2..8e62f788 100644
--- a/signal.cpp
+++ b/signal.cpp
@@ -1,4 +1,4 @@
-/** \file signal.cpp
+/** \file signal.c
The library for various signal related issues
@@ -477,7 +477,7 @@ static void handle_int(int sig, siginfo_t *info, void *context)
}
/**
- sigchld handler. Does notification and calls the handler in proc.cpp
+ sigchld handler. Does notification and calls the handler in proc.c
*/
static void handle_chld(int sig, siginfo_t *info, void *context)
{
diff --git a/tests/test9.in b/tests/test9.in
index 32a537f7..a3a48151 100644
--- a/tests/test9.in
+++ b/tests/test9.in
@@ -79,4 +79,9 @@ for $var1 in 1 2 3
end
echo
+# Test status -n
+eval 'status -n
+status -n
+status -n'
+
false
diff --git a/tests/test9.out b/tests/test9.out
index e44b2604..d4261863 100644
--- a/tests/test9.out
+++ b/tests/test9.out
@@ -10,3 +10,6 @@ Foop
Doop
Testing for loop
123
+1
+2
+3
diff --git a/tokenizer.cpp b/tokenizer.cpp
index 7e4fe02e..67b35fff 100644
--- a/tokenizer.cpp
+++ b/tokenizer.cpp
@@ -1,4 +1,4 @@
-/** \file tokenizer.cpp
+/** \file tokenizer.c
A specialized tokenizer for tokenizing the fish language. In the
future, the tokenizer should be extended to support marks,
diff --git a/util.cpp b/util.cpp
index 61883687..85b9d8d7 100644
--- a/util.cpp
+++ b/util.cpp
@@ -1,4 +1,4 @@
-/** \file util.cpp
+/** \file util.c
Generic utilities library.
Contains datastructures such as automatically growing array lists, priority queues, etc.
diff --git a/wgetopt.cpp b/wgetopt.cpp
index c28d5dc1..ecf1121e 100644
--- a/wgetopt.cpp
+++ b/wgetopt.cpp
@@ -1,4 +1,4 @@
-/** \file wgetopt.cpp
+/** \file wgetopt.c
A version of the getopt library for use with wide character strings.
This is simply the gnu getopt library, but converted for use with
diff --git a/wildcard.cpp b/wildcard.cpp
index 8682f75e..2b93561b 100644
--- a/wildcard.cpp
+++ b/wildcard.cpp
@@ -1,4 +1,4 @@
-/** \file wildcard.cpp
+/** \file wildcard.c
Fish needs it's own globbing implementation to support
tab-expansion of globbed parameters. Also provides recursive
diff --git a/wutil.cpp b/wutil.cpp
index 6889e9c9..ffb4f2b2 100644
--- a/wutil.cpp
+++ b/wutil.cpp
@@ -1,4 +1,4 @@
-/** \file wutil.cpp
+/** \file wutil.c
Wide character equivalents of various standard unix
functions.
*/
diff --git a/xdgmime.cpp b/xdgmime.cpp
index 52a8f21b..633d0b0a 100644
--- a/xdgmime.cpp
+++ b/xdgmime.cpp
@@ -1,6 +1,3 @@
-/** \file xdgmime.cpp
-*/
-
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmime.c: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
*
diff --git a/xdgmimealias.cpp b/xdgmimealias.cpp
index 4636b565..e556d4e6 100644
--- a/xdgmimealias.cpp
+++ b/xdgmimealias.cpp
@@ -1,7 +1,5 @@
-/** \file xdgmimealias.cpp
-*/
/* -*- mode: C; c-file-style: "gnu" -*- */
-/* xdgmimealias.cpp: Private file. Datastructure for storing the aliases.
+/* xdgmimealias.c: Private file. Datastructure for storing the aliases.
*
* More info can be found at http://www.freedesktop.org/standards/
*
diff --git a/xdgmimeglob.cpp b/xdgmimeglob.cpp
index 06021d7c..4182f3c9 100644
--- a/xdgmimeglob.cpp
+++ b/xdgmimeglob.cpp
@@ -1,7 +1,5 @@
-/** \file xdgmimeglob.cpp
-*/
/* -*- mode: C; c-file-style: "gnu" -*- */
-/* xdgmimeglob.cpp: Private file. Datastructure for storing the globs.
+/* xdgmimeglob.c: Private file. Datastructure for storing the globs.
*
* More info can be found at http://www.freedesktop.org/standards/
*
diff --git a/xdgmimeint.cpp b/xdgmimeint.cpp
index 0bad11af..7e8ea31c 100644
--- a/xdgmimeint.cpp
+++ b/xdgmimeint.cpp
@@ -1,8 +1,5 @@
-/** \file xdgmimeint.cpp
-*/
-
/* -*- mode: C; c-file-style: "gnu" -*- */
-/* xdgmimeint.cpp: Internal defines and functions.
+/* xdgmimeint.c: Internal defines and functions.
*
* More info can be found at http://www.freedesktop.org/standards/
*
diff --git a/xdgmimemagic.cpp b/xdgmimemagic.cpp
index 76220220..aecca882 100644
--- a/xdgmimemagic.cpp
+++ b/xdgmimemagic.cpp
@@ -1,6 +1,3 @@
-/** \file xdgmimemagic.cpp
-*/
-
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimemagic.: Private file. Datastructure for storing magic files.
*
diff --git a/xdgmimeparent.cpp b/xdgmimeparent.cpp
index 72fa8b08..d0fa617d 100644
--- a/xdgmimeparent.cpp
+++ b/xdgmimeparent.cpp
@@ -1,5 +1,3 @@
-/** \file xdgmimeparent.cpp
-*/
/* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimealias.c: Private file. Datastructure for storing the hierarchy.
*