Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Support combining multiple specifications #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cava/nightwatch/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions cava/nightwatch/parser/c/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict
from typing import Dict, List

from .rules import *
from .util import *
Expand All @@ -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
Expand Down