/*
- * Copyright (C) 2012, 2013
+ * Copyright (C) 2012, 2013, 2014
* Wolfgang Bumiller
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
if (ch == '\n')
lex_tokench(lex, '\n');
else
- lex_tokench(lex, ' '); /* ch); */
+ lex_tokench(lex, ' ');
}
}
ch = ' '; /* cause TRUE in the isspace check */
ch == '~' || ch == '^' /* ~=, ~, ^ */
) {
lex_tokench(lex, ch);
-
nextch = lex_getch(lex);
- if ((nextch == '=' && ch != '<') ||
- (nextch == ch && ch != '!') ||
- (nextch == '<' && ch == '>')) {
+
+ if ((nextch == '=' && ch != '<') || (nextch == '<' && ch == '>'))
+ lex_tokench(lex, nextch);
+ else if (nextch == ch && ch != '!') {
lex_tokench(lex, nextch);
+ if ((thirdch = lex_getch(lex)) == '=')
+ lex_tokench(lex, thirdch);
+ else
+ lex_ungetch(lex, thirdch);
} else if (ch == '<' && nextch == '=') {
lex_tokench(lex, nextch);
if ((thirdch = lex_getch(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;