예제 #1
0
파일: lexer.cpp 프로젝트: felixangell/llm
void Lexer::getNextToken() {
    switch (this->currentChar) {
        case '0' ... '9':
            recognizeNumber();
            break;
        case 'a' ... 'z':
        case 'A' ... 'Z':
            recognizeIdentifier();
            break;
        case '#':
            eatComments();
            break;
        case '<': case '>':
        case '/': case '*':
        case '+': case '-':
        case '%': case '^':
        case '$': case '!':
        case '=': case '|':
        case '?': case '~':
        case ':':
        case ';': case '\\':
        case '.': case '&':
            recognizeOperator();
            break;
        case '\'':
            recognizeCharacter();
            break;
        case '"':
            recognizeString();
            break;
        case '[': case ']':
        case '(': case ')':
        case '{': case '}':
        case ',':
            recognizeSeparator();
            break;
        case '\0':
            // eof
            this->running = false;
            break;
        case ' ': case '\t': case '\n': case '\r':
            this->pos++;
            this->currentChar = this->file->contents[this->pos];
            break;
        default:
            std::cout << "WHAT YEAR IS IT (" << this->currentChar << ")" << std::endl;
            break;
    }
}
예제 #2
0
    void GeneralRecognizer::SegmentBasedSequenceRecognition(PlateInfo &plateinfo){


        for(auto char_instance:plateinfo.plateChars)
        {


            std::pair<CharType,cv::Mat> res;
            cv::Mat code_table= recognizeCharacter(char_instance.second);
            res.first = char_instance.first;
            code_table.copyTo(res.second);
            plateinfo.appendPlateCoding(res);

        }



    }