1 | //===--- CLI.h - Get grammar from variant sources ----------------*- C++-*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // Provides the Grammar, LRTable etc for a language specified by the `--grammar` |
10 | // flags. It is by design to be used by pseudoparser-based CLI tools. |
11 | // |
12 | // The CLI library defines a `--grammar` CLI flag, which supports 1) using a |
13 | // grammar from a file (--grammar=/path/to/lang.bnf) or using the prebuilt cxx |
14 | // language (--grammar=cxx). |
15 | // |
16 | //===----------------------------------------------------------------------===// |
17 | |
18 | #ifndef CLANG_PSEUDO_CLI_CLI_H |
19 | #define CLANG_PSEUDO_CLI_CLI_H |
20 | |
21 | #include "clang-pseudo/Language.h" |
22 | |
23 | namespace clang { |
24 | namespace pseudo { |
25 | |
26 | // Returns the corresponding Language from the '--grammar' command-line flag. |
27 | // |
28 | // !! If the grammar flag is invalid (e.g. unexisting file), this function will |
29 | // exit the program immediately. |
30 | const Language &getLanguageFromFlags(); |
31 | |
32 | } // namespace pseudo |
33 | } // namespace clang |
34 | |
35 | #endif // CLANG_PSEUDO_CLI_CLI_H |
36 | |