[al] use "quotes" for user imports

Summary:
This changes the syntax for AL imports from `#IMPORT <file>` to `#IMPORT
"file"`. As a side-effect, the `file` part is now lex'd more permissively too.

Reviewed By: dulmarod

Differential Revision: D6784669

fbshipit-source-id: cc1bb73
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent 7fc7511238
commit 6d908adf14

@ -60,8 +60,6 @@ rule token = parse
| "}" { RIGHT_BRACE }
| "(" { LEFT_PAREN }
| ")" { RIGHT_PAREN }
| "<" { LESS_THAN }
| ">" { GREATER_THAN }
| "=" { ASSIGNMENT }
| ";" { SEMICOLON }
| "," { COMMA }
@ -83,7 +81,6 @@ rule token = parse
| "Cond" {COND}
| "PointerToDecl" {POINTER_TO_DECL}
| id { IDENTIFIER (Lexing.lexeme lexbuf) }
| file_id { FILE_IDENTIFIER (Lexing.lexeme lexbuf) }
| '"' { read_string (Buffer.create 80) lexbuf }
| _ { raise (SyntaxError ("Unexpected char: '" ^ (Lexing.lexeme lexbuf) ^"'")) }
| eof { EOF }

@ -48,8 +48,6 @@
%token GLOBAL_MACROS
%token GLOBAL_PATHS
%token HASHIMPORT
%token LESS_THAN
%token GREATER_THAN
%token ET
%token WITH_TRANSITION
%token WHEN
@ -71,7 +69,6 @@
%token IMPLIES
%token REGEXP
%token <string> IDENTIFIER
%token <string> FILE_IDENTIFIER
%token <string> STRING
%token WHITELIST_PATH
%token BLACKLIST_PATH
@ -120,8 +117,8 @@ al_file:
import_files:
| { [] }
| HASHIMPORT LESS_THAN file_identifier GREATER_THAN import_files
{ L.(debug Linters Verbose) "Parsed import clauses...@\n@\n"; $3 :: $5 }
| HASHIMPORT STRING import_files
{ L.(debug Linters Verbose) "Parsed import clauses...@\n@\n"; $2 :: $3 }
;
global_macros:
@ -329,9 +326,4 @@ alexp:
| IDENTIFIER { is_not_infer_reserved_id $1;
L.(debug Linters Verbose) "\tParsed identifier '%s'@\n" $1; $1 }
;
file_identifier:
| FILE_IDENTIFIER { is_not_infer_reserved_id $1;
L.(debug Linters Verbose) "\tParsed file identifier '%s'@\n" $1; $1 }
;
%%

@ -1,4 +1,4 @@
#IMPORT <library.al>
#IMPORT "library.al"
GLOBAL-MACROS {

Loading…
Cancel
Save