Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
NripeshN committed Jul 31, 2024
1 parent 4070612 commit c5664f7
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 69 deletions.
35 changes: 21 additions & 14 deletions src/backend/Opengl/OpenglAst.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def __repr__(self):

def __str__(self):
return f"uniform {self.vtype} {self.name};"



class ConstantNode(ASTNode):
def __init__(self, value):
self.value = value
Expand All @@ -23,9 +24,9 @@ def __repr__(self):
def __str__(self):
return str(self.value)


class VersionDirectiveNode(ASTNode):
def __init__(self,number, profile):
def __init__(self, number, profile):
self.version_number = number
self.profile = profile

Expand All @@ -35,13 +36,13 @@ def __repr__(self):
def __str__(self):
return f"#version {self.version_number} {self.profile}"


class LayoutNode:
def __init__(self, location_number, dtype, name):
self.location_number = location_number
self.dtype = dtype
self.name = name


def __repr__(self):
return f"LayoutNode(location={self.location_number}, dtype={self.dtype})"

Expand All @@ -57,9 +58,10 @@ def __init__(self, condition, true_expr, false_expr):

def __repr__(self):
return f"TernaryOpNode(condition={self.condition}, true_expr={self.true_expr}, false_expr={self.false_expr})"



class LayoutNode:
def __init__(self,section, location_number, dtype, name):
def __init__(self, section, location_number, dtype, name):
self.section = section
self.location_number = location_number
self.dtype = dtype
Expand All @@ -69,10 +71,17 @@ def __repr__(self):
return f"LayoutNode(section={self.section}, location_number={self.location_number}, dtype={self.dtype}, name={self.name})"




class ShaderNode:
def __init__(self, version, global_inputs, global_outputs, uniforms, vertex_section, fragment_section, functions):
def __init__(
self,
version,
global_inputs,
global_outputs,
uniforms,
vertex_section,
fragment_section,
functions,
):
self.version = version
self.global_inputs = global_inputs
self.global_outputs = global_outputs
Expand All @@ -86,7 +95,7 @@ def __repr__(self):


class VERTEXShaderNode:
def __init__(self, inputs, outputs,uniform, functions, layout_qualifiers=[]):
def __init__(self, inputs, outputs, uniform, functions, layout_qualifiers=[]):
self.inputs = inputs
self.outputs = outputs
self.uniform = uniform
Expand All @@ -98,17 +107,15 @@ def __repr__(self):


class FRAGMENTShaderNode:
def __init__(self, inputs, outputs,uniform,functions,layout_qualifiers = []):
def __init__(self, inputs, outputs, uniform, functions, layout_qualifiers=[]):
self.inputs = inputs
self.outputs = outputs
self.uniform = uniform
self.functions = functions
self.layout_qualifiers = layout_qualifiers

def __repr__(self):
return (
f"FRAGMENTShaderNode({self.inputs!r}) {self.outputs!r}{self.uniform!r} {self.functions!r}{self.layout_qualifiers!r}"
)
return f"FRAGMENTShaderNode({self.inputs!r}) {self.outputs!r}{self.uniform!r} {self.functions!r}{self.layout_qualifiers!r}"


class FunctionNode(ASTNode):
Expand Down
4 changes: 2 additions & 2 deletions src/backend/Opengl/OpenglLexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
("INT", r"int"),
("SAMPLER2D", r"sampler2D"),
("PRE_INCREMENT", r"\+\+(?=\w)"), # Lookahead to match pre-increment
("PRE_DECREMENT", r"--(?=\w)"), # Lookahead to match pre-decrement
("PRE_DECREMENT", r"--(?=\w)"), # Lookahead to match pre-decrement
("POST_INCREMENT", r"(?<=\w)\+\+"), # Lookbehind to match post-increment
("POST_DECREMENT", r"(?<=\w)--"), # Lookbehind to match post-decrement
("POST_DECREMENT", r"(?<=\w)--"), # Lookbehind to match post-decrement
("IDENTIFIER", r"[a-zA-Z_][a-zA-Z_0-9]*"),
("LBRACE", r"\{"),
("RBRACE", r"\}"),
Expand Down
Loading

0 comments on commit c5664f7

Please sign in to comment.