예제 #1
0
    bool VisitDecl(clang::Decl *decl)
    {
        if (markedAsSuppress(decl, _rule))
        {
            clang::SourceLocation startLocation = decl->getLocStart();
            clang::SourceLocation endLocation = decl->getLocEnd();
            unsigned startLineNumber = _sourceManager->getPresumedLineNumber(startLocation);
            unsigned endLineNumber = _sourceManager->getPresumedLineNumber(endLocation);
            _range.insert(std::make_pair(startLineNumber, endLineNumber));
        }

        return true;
    }
예제 #2
0
	NodePtr parsePrimitive()
	{
		NodePtr p = nullptr;
		RangeSet st;
		// lookahead
		switch (reader.peek())
		{
		case '\\':
			reader.next();
			switch (reader.peek())
			{
			case 'd':
				st.insert({ '0', '9' });
				reader.next();
				return std::make_shared<CharsetNode>(st);
				break;
			case '{': case '}': case '|':
			case '(': case ')': case '.':
			case '+': case '*': case '?':
			case '\\': case 'n': case 't':
				return std::make_shared<CharNode>(reader.next());
				break;
			default:
				throw ParseError();
			}
			reader.next();
			break;
		case '(':
			reader.next();
			p = parseRE();
			if (reader.peek() != ')')
			{
				throw ParseError();
			}
			reader.next();
			return p;
		case '\0': case '*': case '|':
			throw ParseError();
			break;
		case '.':
			reader.next();
			return std::make_shared<WildcardNode>();
			break;
		default:
			return std::make_shared<CharNode>(reader.next());
		}
	}