예제 #1
0
파일: preprocess.py 프로젝트: vmfox/vunit
 def expand(self, values, previous):
     """
     Expand macro with actual values, returns a list of expanded tokens
     """
     tokens = []
     for token in self.tokens:
         if token.kind == IDENTIFIER and token.value in self.args:
             idx = self.args.index(token.value)
             value = values[idx]
             tokens += value
         else:
             tokens.append(token)
     return [Token(tok.kind, tok.value, add_previous(tok.location, previous))
             for tok in tokens]
예제 #2
0
def strip_loc(tokens):
    """
    Strip location information
    """
    return [Token(token.kind, token.value, None) for token in tokens]
예제 #3
0
파일: tokenizer.py 프로젝트: tivaliy/vunit
        def replace_keywords(token):  # pylint: disable=missing-docstring
            if token.value in KEYWORDS:
                return Token(KEYWORDS[token.value], '', token.location)

            return token
예제 #4
0
파일: tokenizer.py 프로젝트: tivaliy/vunit
 def remove_value(token):
     return Token(token.kind, '', token.location)
예제 #5
0
파일: tokenizer.py 프로젝트: tivaliy/vunit
 def slice_value(token, start=None, end=None):
     return Token(token.kind, token.value[start:end], token.location)
예제 #6
0
파일: tokenizer.py 프로젝트: wzab/vunit
 def str_value(token):
     return Token(
         token.kind,
         token.value[1:-1].replace("\\\n", "").replace("\\\"", "\""),
         token.location)
예제 #7
0
파일: tokenizer.py 프로젝트: zberkes/vunit
 def replace_keywords(token):
     if token.value in KEYWORDS:
         return Token(KEYWORDS[token.value], '', token.location)
     else:
         return token