bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/6] bistromathic: don't require spaces after operators for compl


From: Akim Demaille
Subject: [PATCH 2/6] bistromathic: don't require spaces after operators for completion
Date: Tue, 3 Mar 2020 18:35:22 +0100

Currently "(1+<TAB>" does not work as expected, because "+" is not a
word breaking character.

* examples/c/bistromathic/parse.y (init_readline): Specify our word
breaking characters.
* examples/c/bistromathic/bistromathic.test: Avoid trailing spaces.
---
 examples/c/bistromathic/bistromathic.test | 8 ++++----
 examples/c/bistromathic/parse.y           | 8 ++++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/examples/c/bistromathic/bistromathic.test 
b/examples/c/bistromathic/bistromathic.test
index ad614283..0bec1cb3 100755
--- a/examples/c/bistromathic/bistromathic.test
+++ b/examples/c/bistromathic/bistromathic.test
@@ -86,11 +86,11 @@ run 0 '> 1 / 0
 ## ------------ ##
 
 sed -e 's/\\t/ /g' >input <<EOF
-( 1 + \t\t
+(1+\t\t
 EOF
-run 0 '> ( 1 + 
+run 0 '> (1+
 (                        cos                      ln
 -                        double precision number  sin
 atan                     exp                      sqrt
-> ( 1 + 
-> err: 1.7: syntax error: expected - or ( or double precision number or 
function or variable before end of file'
+> (1+
+> err: 1.4: syntax error: expected - or ( or double precision number or 
function or variable before end of file'
diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y
index 971f9b56..16e327b0 100644
--- a/examples/c/bistromathic/parse.y
+++ b/examples/c/bistromathic/parse.y
@@ -426,11 +426,15 @@ completion (const char *text, int start, int end)
 
 void init_readline (void)
 {
-  /* Allow conditional parsing of the ~/.inputrc file. */
+  // Allow conditional parsing of the ~/.inputrc file.
   rl_readline_name = "pushcalc";
 
-  /* Tell the completer that we want a crack first. */
+  // Tell the completer that we want a crack first.
   rl_attempted_completion_function = completion;
+
+  // The basic list of characters that signal a break between words
+  // for the completer routine.
+  rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{(+-*/^)";
 }
 
 
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]