Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch ( peek() ){
- case '{':{
- ADVANCE_AND_ACCEPT(TokenID::OpLBrace);
- }break;
- case '}': {
- ADVANCE_AND_ACCEPT(TokenID::OpRBrace);
- }break;
- case '(': {
- ADVANCE_AND_ACCEPT(TokenID::OpLParen);
- }break;
- case ')': {
- ADVANCE_AND_ACCEPT(TokenID::OpRParen);
- }break;
- case '[': {
- ADVANCE_AND_ACCEPT(TokenID::OpLBracket);
- }break;
- case ']': {
- ADVANCE_AND_ACCEPT(TokenID::OpRBracket);
- }break;
- case '.': {
- ADVANCE_AND_ACCEPT(TokenID::OpDot);
- }break;
- case ',': {
- ADVANCE_AND_ACCEPT(TokenID::OpComma);
- }break;
- case ':': {
- ADVANCE_AND_ACCEPT(TokenID::OpColon);
- }break;
- case '+':{
- ADVANCE_AND_ACCEPT(TokenID::OpPlus);
- }break;
- case '/': {
- advance();
- switch (peek()) {
- case '/': {
- advance();
- scanLineComment();
- return;
- }break;
- default: {
- ACCEPT(TokenID::OpDiv);
- }break;
- }
- }break;
- case '*': {
- ADVANCE_AND_ACCEPT(TokenID::OpMult);
- }break;
- case '&': {
- ADVANCE_AND_ACCEPT(TokenID::OpAmpersand);
- }break;
- case ';': {
- ADVANCE_AND_ACCEPT(TokenID::OpSemicolon);
- }break;
- case '?': {
- ADVANCE_AND_ACCEPT(TokenID::OpQuestion);
- }break;
- case '=': {
- advance();
- switch (peek()) {
- case '=': {
- ADVANCE_AND_ACCEPT(TokenID::OpEQ);
- }break;
- default: {
- ACCEPT(TokenID::OpAssign);
- }break;
- }
- }break;
- case '<': {
- advance();
- switch (peek()) {
- case '=': {
- ADVANCE_AND_ACCEPT(TokenID::OpLE);
- }break;
- case '>': {
- ADVANCE_AND_ACCEPT(TokenID::OpNEQ);
- }break;
- default: {
- ACCEPT(TokenID::OpLT);
- }break;
- }
- }break;
- case '>': {
- advance();
- switch (peek()) {
- case '=': {
- ADVANCE_AND_ACCEPT(TokenID::OpGE);
- }break;
- default: {
- ACCEPT(TokenID::OpGT);
- }break;
- }
- }break;
- case '-': {
- advance();
- switch ( peek() ){
- case '>':{
- ADVANCE_AND_ACCEPT(TokenID::OpArrow);
- }break;
- default:{
- ACCEPT(TokenID::OpMinus);
- }break;
- }
- }break;
- default:{
- report(LexerError::Code::UnexpectedCharacter);
- advance();
- scanBadCharacters();
- }break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement