How to use the vsg.parser function in vsg

To help you get started, we’ve selected a few vsg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jeremiah-c-leary / vhdl-style-guide / vsg / rules / context / rule_022.py View on Github external
def __init__(self):
        copy_item_value_and_insert_new_item_after_item_rule.__init__(self, 'context', '022', parser.context_end_context_keyword, parser.context_semicolon, parser.context_identifier, parser.context_end_identifier('unknown'))
        self.solution = 'missing context identifier'
        self.subphase = 2
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / context / rule_003.py View on Github external
def __init__(self):
        insert_blank_line_above_line_containing_item_rule.__init__(self, 'context', '003', parser.context_keyword, True)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / context / rule_012.py View on Github external
def __init__(self):
        case_item_rule.__init__(self, 'context', '012', parser.context_identifier)
github jeremiah-c-leary / vhdl-style-guide / vsg / vhdlFile / classify / context.py View on Github external
def classify_context_end_context_keyword(sToken, iToken, lObjects):
    if sToken.lower() == 'context':  
        lObjects[iToken] = parser.context_end_context_keyword(sToken)
github jeremiah-c-leary / vhdl-style-guide / vsg / vhdlFile / classify / context.py View on Github external
def classify_context_end_identifier(sToken, iToken, lObjects):
    if sToken.lower() != 'context' and sToken != ';' and not isinstance(lObjects[iToken], parser.whitespace) and not isinstance(lObjects[iToken], parser.comment):
        lObjects[iToken] = parser.context_end_identifier(sToken)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / space_between_items_rule.py View on Github external
def analyze(self, oFile):
        self._print_debug_message('Analyzing rule: ' + self.name + '_' + self.identifier)
        lContexts = oFile.get_context_declarations()
        for dContext in lContexts:
            for iLine, oLine in enumerate(dContext['lines']):
                lObjects = oLine.get_objects()
                lAnalysis = []
                bLeftFound = False
                for iObject, oObject in enumerate(lObjects):
                    if isinstance(oObject, self.left):
                        bLeftFound = True
                    if bLeftFound:
                        lAnalysis.append(oObject)
                    if isinstance(oObject, self.right):
                        if len(lAnalysis) == 3:
                            if isinstance(lAnalysis[1], parser.whitespace):
                                if lAnalysis[1].get_value() != ' ' * self.spaces:
                                    dViolation = utils.create_violation_dict(dContext['metadata']['iStartLineNumber'] + iLine)
                                    dViolation['solution'] = 'Ensure there are only ' + str(self.spaces) + ' space(s) between "' + lAnalysis[0].get_value() + '" and "' + lAnalysis[2].get_value() + '"'
                                    self.add_violation(dViolation)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / context / rule_021.py View on Github external
def __init__(self):
        insert_item_after_item_rule.__init__(self, 'context', '021', parser.context_end_keyword, parser.context_semicolon, parser.context_end_context_keyword('context'))
        self.insert_space = True
github jeremiah-c-leary / vhdl-style-guide / vsg / vhdlFile / classify / context.py View on Github external
def classify_context_end_keyword(sToken, iToken, lObjects, dVars):
    if sToken.lower() == 'end':
        lObjects[iToken] = parser.context_end_keyword(sToken)
        dVars['bContextEndFound'] = True