diff --git a/cava/nightwatch/main.py b/cava/nightwatch/main.py index d9fe3aab..3a549a2f 100644 --- a/cava/nightwatch/main.py +++ b/cava/nightwatch/main.py @@ -30,6 +30,8 @@ def main(): "suit.") parser.add_argument("--dump", action="store_true", help="Output the API model in roughly the input format. This will loose information.") + parser.add_argument("--combine", "-C", type=str, action="append", dest="combine_files", + help="Combine specifications with the current one.") args = parser.parse_args() @@ -47,8 +49,13 @@ def main(): errors = [] from .parser import c - api = c.parse(args.inputfile, include_path=args.include_path or [], definitions=args.definitions or [], - extra_args=(["-v"] if args.verbose else []) + (args.extra_args or [])) + api = c.parse( + args.inputfile, + include_path=args.include_path or [], + definitions=args.definitions or [], + extra_args=(["-v"] if args.verbose else []) + (args.extra_args or []), + combine_files=args.combine_files or [], + ) if args.dump: print(api) diff --git a/cava/nightwatch/parser/c/__init__.py b/cava/nightwatch/parser/c/__init__.py index 1c78cdbb..4228657a 100644 --- a/cava/nightwatch/parser/c/__init__.py +++ b/cava/nightwatch/parser/c/__init__.py @@ -1,4 +1,4 @@ -from typing import Dict +from typing import Dict, List from .rules import * from .util import * @@ -9,7 +9,12 @@ deallocates_amount_prefix = "deallocates_amount_" -def parse(filename: str, include_path, definitions, extra_args): +def parse( + filename: str, + include_path: List[str], + definitions: List[str], + extra_args: List[str], + combine_files: List[str]): index = Index.create(True) includes = [s for p in include_path