X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=lexer.c;h=a495d27fa4cb034305b735ddef884198885e4267;hp=71373255e634f8357bf7a3340d05ad15c1c796b8;hb=893f204b30affbb4407fcddb16576156a648eac6;hpb=15b31e7dc5ddef02acd22d0256cbfffe9df09b5c diff --git a/lexer.c b/lexer.c index 7137325..a495d27 100644 --- a/lexer.c +++ b/lexer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2013, 2014 + * Copyright (C) 2012, 2013, 2014, 2015 * Wolfgang Bumiller * * Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -1308,28 +1308,6 @@ int lex_do(lex_file *lex) return (lex->tok.ttype = TOKEN_OPERATOR); } - /* length operator */ - if (ch == 'l') { - if ((nextch = lex_getch(lex)) == 'e') { - if ((nextch = lex_getch(lex)) == 'n') { - if ((nextch = lex_getch(lex)) == 'g') { - if ((nextch = lex_getch(lex)) == 't') { - if ((nextch = lex_getch(lex)) == 'h') { - lex_tokench(lex, 'l'); - lex_tokench(lex, 'e'); - lex_tokench(lex, 'n'); - lex_tokench(lex, 'g'); - lex_tokench(lex, 't'); - lex_tokench(lex, 'h'); - lex_endtoken(lex); - return (lex->tok.ttype = TOKEN_OPERATOR); - } else lex_ungetch(lex, nextch); - } else lex_ungetch(lex, nextch); - } else lex_ungetch(lex, nextch); - } else lex_ungetch(lex, nextch); - } else lex_ungetch(lex, nextch); - } - if (isident_start(ch)) { const char *v; @@ -1361,6 +1339,8 @@ int lex_do(lex_file *lex) } else if (!strcmp(v, "vector")) { lex->tok.ttype = TOKEN_TYPENAME; lex->tok.constval.t = TYPE_VECTOR; + } else if (!strcmp(v, "_length")) { + lex->tok.ttype = TOKEN_OPERATOR; } else { size_t kw; for (kw = 0; kw < GMQCC_ARRAY_COUNT(keywords_qc); ++kw) {