Skip to content
Draft
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
1 change: 1 addition & 0 deletions compile_flags/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: 2025-present Yiannis Charalambous <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0

__version__ = "0.0.1"
8 changes: 8 additions & 0 deletions compile_flags/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# SPDX-FileCopyrightText: 2025-present Yiannis Charalambous <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0

from compile_flags.solution import Solution, SourceFile

__all__ = [
"Solution",
"SourceFile",
]

10 changes: 10 additions & 0 deletions compile_flags/parsers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2025-present Yiannis Charalambous <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0

from .base_parser import BaseSolutionParser, CLikeParser

__all__ = [
"BaseSolutionParser",
"CLikeParser",
]
17 changes: 17 additions & 0 deletions compile_flags/parsers/base_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2025-present Yiannis Charalambous <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0

from pydantic import BaseModel, Field

from compile_flags import Solution


class BaseSolutionParser(BaseModel):
"""Base parser class for analyzing a code base."""

solution: Solution = Field()


class CLikeParser(BaseSolutionParser):
"""C and C++ based parser."""
24 changes: 24 additions & 0 deletions compile_flags/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2025-present Yiannis Charalambous <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0

from pydantic import BaseModel, Field, FilePath


class SourceFile(BaseModel):
"""Represents a generic source file."""

path: FilePath = Field(description="The file path of this source file.")

@property
def dependencies(self) -> list[FilePath]:
"""Gets the deps of this source file. Needs to be overwritten."""
return []


class Solution(BaseModel):
"""Represents the codebase."""

source_files: dict[FilePath, SourceFile] = Field(
default_factory=dict, description="The list of source files."
)