changeset 23840:dca84dfe167f

Add "import" to list of Octave language keywords (bug #51688). This is only a start towards truly implementing the import keyword. * NEWS: Announce new keyword. * lex.ll (base_lexer::is_keyword_token): Add case statement for import_kw. * oct-parse.in.yy: Add new tok_val IMPORT * octave.gperf (enum octave_kw_id): Add import_kw to list. * octave.gperf (struct octave_kw): Add import, IMPORT, import_kw to struct.
author Rik <rik@octave.org>
date Tue, 08 Aug 2017 09:04:07 -0700
parents 724fe19b50dc
children 3930c54f8462
files NEWS libinterp/parse-tree/lex.ll libinterp/parse-tree/oct-parse.in.yy libinterp/parse-tree/octave.gperf
diffstat 4 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Aug 08 08:53:37 2017 -0700
+++ b/NEWS	Tue Aug 08 09:04:07 2017 -0700
@@ -30,6 +30,11 @@
     array, rather than a struct with a cell array for each field.  This
     change was made for Matlab compatibility.
 
+ ** New keyword "import" added to parser.
+
+    The parser recognizes the reserved keyword "import", but there is no
+    implementation of the functionality.
+
  ** Other new functions added in 4.4:
 
       corrcoef
--- a/libinterp/parse-tree/lex.ll	Tue Aug 08 08:53:37 2017 -0700
+++ b/libinterp/parse-tree/lex.ll	Tue Aug 08 09:04:07 2017 -0700
@@ -2579,6 +2579,10 @@
           case until_kw:
             break;
 
+          case import_kw:
+            at_beginning_of_statement = true;
+            break;
+
           case end_kw:
             if (inside_any_object_index ()
                 || (defining_func
--- a/libinterp/parse-tree/oct-parse.in.yy	Tue Aug 08 08:53:37 2017 -0700
+++ b/libinterp/parse-tree/oct-parse.in.yy	Tue Aug 08 09:04:07 2017 -0700
@@ -215,6 +215,7 @@
 %token <tok_val> FCN_HANDLE
 %token <tok_val> CLASSDEF
 %token <tok_val> PROPERTIES METHODS EVENTS ENUMERATION
+%token <tok_val> IMPORT
 %token <tok_val> METAQUERY
 %token <tok_val> SUPERCLASSREF
 %token <tok_val> FQ_IDENT
--- a/libinterp/parse-tree/octave.gperf	Tue Aug 08 08:53:37 2017 -0700
+++ b/libinterp/parse-tree/octave.gperf	Tue Aug 08 09:04:07 2017 -0700
@@ -55,6 +55,7 @@
   get_kw,
   global_kw,
   if_kw,
+  import_kw,
   magic_file_kw,
   magic_line_kw,
   methods_kw,
@@ -103,6 +104,7 @@
 get, GET, get_kw
 global, GLOBAL, global_kw
 if, IF, if_kw
+import, IMPORT, import_kw
 methods, METHODS, methods_kw
 otherwise, OTHERWISE, otherwise_kw
 parfor, PARFOR, parfor_kw