From 6d908adf14ffb23b890818b7c00866465a54bb9f Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 23 Jan 2018 06:51:35 -0800 Subject: [PATCH] [al] use "quotes" for user imports Summary: This changes the syntax for AL imports from `#IMPORT ` 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 --- infer/src/clang/ctl_lexer.mll | 3 --- infer/src/clang/ctl_parser.mly | 12 ++---------- .../objc/linters-for-test-only/linters_example.al | 2 +- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/infer/src/clang/ctl_lexer.mll b/infer/src/clang/ctl_lexer.mll index 6b6384298..bce14c2a8 100644 --- a/infer/src/clang/ctl_lexer.mll +++ b/infer/src/clang/ctl_lexer.mll @@ -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 } diff --git a/infer/src/clang/ctl_parser.mly b/infer/src/clang/ctl_parser.mly index 4e5550eca..c944c2720 100644 --- a/infer/src/clang/ctl_parser.mly +++ b/infer/src/clang/ctl_parser.mly @@ -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 IDENTIFIER -%token FILE_IDENTIFIER %token 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 } - ; %% diff --git a/infer/tests/codetoanalyze/objc/linters-for-test-only/linters_example.al b/infer/tests/codetoanalyze/objc/linters-for-test-only/linters_example.al index 0926d7153..e52db5c13 100644 --- a/infer/tests/codetoanalyze/objc/linters-for-test-only/linters_example.al +++ b/infer/tests/codetoanalyze/objc/linters-for-test-only/linters_example.al @@ -1,4 +1,4 @@ -#IMPORT +#IMPORT "library.al" GLOBAL-MACROS {