diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-02-27 13:16:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-02-27 21:49:09 +0100 |
commit | 86e0e147984f8ca48ab0a9c88c37e9e4c4274088 (patch) | |
tree | a6db3f3ad0877108a95d1246d3d979869f585b65 /idlc | |
parent | 69e9262eeb24fa40c3f3f5e7c90c643b252b6b57 (diff) |
Untabify .l files (to silence loplugin:indentation warnings)
Change-Id: I8368c8a1d52f6c55a8cea952b2b02345e41c1e5c
Reviewed-on: https://gerrit.libreoffice.org/68448
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/source/scanner.l | 422 |
1 files changed, 211 insertions, 211 deletions
diff --git a/idlc/source/scanner.l b/idlc/source/scanner.l index 91bf9f2646a6..40f3670f78f5 100644 --- a/idlc/source/scanner.l +++ b/idlc/source/scanner.l @@ -58,8 +58,8 @@ int yycolumn = 1; #define YY_USER_ACTION idlc()->setOffset(yycolumn, yycolumn+yyleng-1); \ yycolumn += yyleng; -sal_Int32 beginLine = 0; -OString docu; +sal_Int32 beginLine = 0; +OString docu; static int asciiToInteger(char const * s, sal_Int64 * sval, sal_uInt64 * uval) { bool neg = false; @@ -148,105 +148,105 @@ static int asciiToInteger(char const * s, sal_Int64 * sval, sal_uInt64 * uval) static double asciiToFloat(const sal_Char *s) { - double d = 0.0; - double e, k; - sal_Int32 neg = 0; - - if (*s == '-') - { - neg = 1; - s++; - } - while (*s >= '0' && *s <= '9') - { - d = (d * 10) + *s - '0'; - s++; - } - if (*s == '.') - { - s++; - e = 10; - while (*s >= '0' && *s <= '9') - { - d += (*s - '0') / (e * 1.0); - e *= 10; - s++; - } - } - if (*s == 'e' || *s == 'E') - { - s++; - if (*s == '-') + double d = 0.0; + double e, k; + sal_Int32 neg = 0; + + if (*s == '-') + { + neg = 1; + s++; + } + while (*s >= '0' && *s <= '9') + { + d = (d * 10) + *s - '0'; + s++; + } + if (*s == '.') + { + s++; + e = 10; + while (*s >= '0' && *s <= '9') + { + d += (*s - '0') / (e * 1.0); + e *= 10; + s++; + } + } + if (*s == 'e' || *s == 'E') + { + s++; + if (*s == '-') + { + s++; + } else { - s++; - } else - { - if (*s == '+') - s++; - e = 0; - while (*s >= '0' && *s <= '9') - { - e = (e * 10) + *s - '0'; - s++; - } - if (e > 0) - { + if (*s == '+') + s++; + e = 0; + while (*s >= '0' && *s <= '9') + { + e = (e * 10) + *s - '0'; + s++; + } + if (e > 0) + { for (k = 1; e > 0; k *= 10, e--) ; d /= k; - } - } - } - if (neg) d *= -1.0; - return d; + } + } + } + if (neg) d *= -1.0; + return d; } -static void idlParsePragma(sal_Char* pPragma) +static void idlParsePragma(sal_Char* pPragma) { - OString pragma(pPragma); - sal_Int32 index = pragma.indexOf("include"); - sal_Char* begin = pPragma + index + 8; - sal_Char* offset = begin; - while (*offset != ',') offset++; - //OString include = pragma.copy(index + 8, offset - begin); - //unused// idlc()->insertInclude(pragma.copy(index + 8, (sal_Int32)(offset - begin))); -} + OString pragma(pPragma); + sal_Int32 index = pragma.indexOf("include"); + sal_Char* begin = pPragma + index + 8; + sal_Char* offset = begin; + while (*offset != ',') offset++; + //OString include = pragma.copy(index + 8, offset - begin); + //unused// idlc()->insertInclude(pragma.copy(index + 8, (sal_Int32)(offset - begin))); +} static void parseLineAndFile(sal_Char* pBuf) { - sal_Char *r = pBuf; - sal_Char *h; - bool bIsInMain = false; - - /* Skip initial '#' */ - if (*r != '#') - return; - - /* Find line number */ - for (r++; *r == ' ' || *r == '\t' || rtl::isAsciiAlpha(static_cast<unsigned char>(*r)); r++) ; - h = r; - for (; *r != '\0' && *r != ' ' && *r != '\t'; r++) ; - *r++ = 0; - idlc()->setLineNumber((sal_uInt32)atol(h)); + sal_Char *r = pBuf; + sal_Char *h; + bool bIsInMain = false; + + /* Skip initial '#' */ + if (*r != '#') + return; + + /* Find line number */ + for (r++; *r == ' ' || *r == '\t' || rtl::isAsciiAlpha(static_cast<unsigned char>(*r)); r++) ; + h = r; + for (; *r != '\0' && *r != ' ' && *r != '\t'; r++) ; + *r++ = 0; + idlc()->setLineNumber((sal_uInt32)atol(h)); yylineno = atol(h); - /* Find file name, if present */ - for (; *r != '"'; r++) - { - if (*r == '\n' || *r == '\0') - return; - } - h = ++r; - for (; *r != '"'; r++) ; - *r = 0; - if (*h == '\0') - idlc()->setFileName(OString("standard input")); - else - idlc()->setFileName(OString(h)); - - bIsInMain = idlc()->getFileName() == idlc()->getRealFileName(); - idlc()->setInMainfile(bIsInMain); -} + /* Find file name, if present */ + for (; *r != '"'; r++) + { + if (*r == '\n' || *r == '\0') + return; + } + h = ++r; + for (; *r != '"'; r++) ; + *r = 0; + if (*h == '\0') + idlc()->setFileName(OString("standard input")); + else + idlc()->setFileName(OString(h)); + + bIsInMain = idlc()->getFileName() == idlc()->getRealFileName(); + idlc()->setInMainfile(bIsInMain); +} // Suppress any warnings from generated code: #ifdef __GNUC__ @@ -283,7 +283,7 @@ IDENTIFIER ("_"?({ALPHA}|{DIGIT})+)* %% -[ \t\r]+ ; /* eat up whitespace */ +[ \t\r]+ ; /* eat up whitespace */ [\n] { idlc()->incLineNumber(); yycolumn = 1; @@ -316,7 +316,7 @@ struct return IDL_STRUCT; transient return IDL_TRANSIENT; typedef return IDL_TYPEDEF; -any return IDL_ANY; +any return IDL_ANY; boolean return IDL_BOOLEAN; byte return IDL_BYTE; char return IDL_CHAR; @@ -358,165 +358,165 @@ published return IDL_PUBLISHED; return asciiToInteger(yytext, &yylval.ival, &yylval.uval); } -("-")?{DIGIT}+(e|E)(("+"|"-")?{DIGIT}+)?(f|F)? | +("-")?{DIGIT}+(e|E)(("+"|"-")?{DIGIT}+)?(f|F)? | ("-")?{DIGIT}*"."{DIGIT}+((e|E)("+"|"-")?{DIGIT}+)?(f|F)? { yylval.dval = asciiToFloat( yytext ); - return IDL_FLOATING_PT_LITERAL; + return IDL_FLOATING_PT_LITERAL; + } + +{IDENTIFIER} { + yylval.sval = new OString(yytext); + return IDL_IDENTIFIER; + } + +\<\< { + yylval.strval = yytext; + return IDL_LEFTSHIFT; + } +\>\> { + yylval.strval = yytext; + return IDL_RIGHTSHIFT; + } +\:\: { + yylval.strval = yytext; + return IDL_SCOPESEPARATOR; + } + +"/*" { + BEGIN( COMMENT ); + docu = OString(); + beginLine = idlc()->getLineNumber(); + } + +"/***" { + BEGIN( COMMENT ); + docu = OString(); + beginLine = idlc()->getLineNumber(); + } + +<COMMENT>[^*]+ { + docu += OString(yytext); + } + +<COMMENT>"*"[^*/]+ { + docu += OString(yytext); } -{IDENTIFIER} { - yylval.sval = new OString(yytext); - return IDL_IDENTIFIER; - } - -\<\< { - yylval.strval = yytext; - return IDL_LEFTSHIFT; - } -\>\> { - yylval.strval = yytext; - return IDL_RIGHTSHIFT; - } -\:\: { - yylval.strval = yytext; - return IDL_SCOPESEPARATOR; - } - -"/*" { - BEGIN( COMMENT ); - docu = OString(); - beginLine = idlc()->getLineNumber(); - } - -"/***" { - BEGIN( COMMENT ); - docu = OString(); - beginLine = idlc()->getLineNumber(); - } - -<COMMENT>[^*]+ { - docu += OString(yytext); - } - -<COMMENT>"*"[^*/]+ { - docu += OString(yytext); - } - -<COMMENT>"**" { - docu += OString(yytext); - } +<COMMENT>"**" { + docu += OString(yytext); + } <COMMENT>[*]+"/" { - docu = docu.trim(); + docu = docu.trim(); + sal_Int32 nIndex = 0; + int count = 0; + do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + idlc()->setLineNumber( beginLine + count - 1); + BEGIN( INITIAL ); + } + +"/**" { + BEGIN( DOCU ); + docu = OString(); + beginLine = idlc()->getLineNumber(); + } + +<DOCU>[^*\n]+ { + docu += OString(yytext); + } + +<DOCU>"\n"[ \t]*"*"{1} { + idlc()->setLineNumber( idlc()->getLineNumber() + 1); + docu += OString("\n"); + } + +<DOCU>"\n" { + idlc()->setLineNumber( idlc()->getLineNumber() + 1); + docu += OString(yytext); + } + +<DOCU>"*"[^*^/\n]* { + docu += OString(yytext); + } + +<DOCU>"\n"[ \t]*"*/" { + docu = docu.trim(); sal_Int32 nIndex = 0; int count = 0; do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); - idlc()->setLineNumber( beginLine + count - 1); - BEGIN( INITIAL ); - } - -"/**" { - BEGIN( DOCU ); - docu = OString(); - beginLine = idlc()->getLineNumber(); - } - -<DOCU>[^*\n]+ { - docu += OString(yytext); - } - -<DOCU>"\n"[ \t]*"*"{1} { - idlc()->setLineNumber( idlc()->getLineNumber() + 1); - docu += OString("\n"); - } - -<DOCU>"\n" { - idlc()->setLineNumber( idlc()->getLineNumber() + 1); - docu += OString(yytext); - } - -<DOCU>"*"[^*^/\n]* { - docu += OString(yytext); - } - -<DOCU>"\n"[ \t]*"*/" { - docu = docu.trim(); - sal_Int32 nIndex = 0; - int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); - idlc()->setLineNumber( beginLine + count - 1); - if ( (nIndex = docu.indexOf("/*")) >= 0 || (nIndex = docu.indexOf("///")) >= 0 ) - { + idlc()->setLineNumber( beginLine + count - 1); + if ( (nIndex = docu.indexOf("/*")) >= 0 || (nIndex = docu.indexOf("///")) >= 0 ) + { if ( 0 != nIndex && (docu[nIndex - 1] != '"' && docu[nIndex - 1] != ':') ) ErrorHandler::syntaxError(PS_NoState, idlc()->getLineNumber(), "nested documentation strings are not allowed!"); - } - idlc()->setDocumentation(docu); - BEGIN( INITIAL ); - } - -<DOCU>"*/" { - docu = docu.trim(); - sal_Int32 nIndex = 0; - int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); - idlc()->setLineNumber( beginLine + count - 1); - if ( docu.indexOf("/*") >= 0 || docu.indexOf("//") >= 0 ) - { + } + idlc()->setDocumentation(docu); + BEGIN( INITIAL ); + } + +<DOCU>"*/" { + docu = docu.trim(); + sal_Int32 nIndex = 0; + int count = 0; + do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + idlc()->setLineNumber( beginLine + count - 1); + if ( docu.indexOf("/*") >= 0 || docu.indexOf("//") >= 0 ) + { if ( 0 != nIndex && (docu[nIndex - 1] != '"' && docu[nIndex - 1] != ':') ) ErrorHandler::syntaxError(PS_NoState, idlc()->getLineNumber(), "nested documentation strings are not allowed!"); - } - idlc()->setDocumentation(docu); - BEGIN( INITIAL ); - } + } + idlc()->setDocumentation(docu); + BEGIN( INITIAL ); + } "//"[^/]{1}.*"\n" { - /* only a comment */ - OString docStr(yytext); - docStr = docStr.copy( 0, docStr.lastIndexOf('\n') ); - docStr = docStr.copy( docStr.lastIndexOf('/')+1 ); - docStr = docStr.trim(); - idlc()->incLineNumber(); - } + /* only a comment */ + OString docStr(yytext); + docStr = docStr.copy( 0, docStr.lastIndexOf('\n') ); + docStr = docStr.copy( docStr.lastIndexOf('/')+1 ); + docStr = docStr.trim(); + idlc()->incLineNumber(); + } "///".*"\n" { - OString docStr(yytext); - docStr = docStr.copy( 0, docStr.lastIndexOf('\n') ); - docStr = docStr.copy( docStr.lastIndexOf('/')+1 ); - docStr = docStr.trim(); - idlc()->incLineNumber(); - idlc()->setDocumentation(docStr); - } + OString docStr(yytext); + docStr = docStr.copy( 0, docStr.lastIndexOf('\n') ); + docStr = docStr.copy( docStr.lastIndexOf('/')+1 ); + docStr = docStr.trim(); + idlc()->incLineNumber(); + idlc()->setDocumentation(docStr); + } -. return yytext[0]; +. return yytext[0]; ^#[ \t]*line[ \t]*[0-9]*" ""\""[^\"]*"\""\n { - parseLineAndFile(yytext); + parseLineAndFile(yytext); } ^#[ \t]*[0-9]*" ""\""[^\"]*"\""" "[0-9]*\n { - parseLineAndFile(yytext); + parseLineAndFile(yytext); } ^#[ \t]*[0-9]*" ""\""[^\"]*"\""\n { - parseLineAndFile(yytext); + parseLineAndFile(yytext); } ^#[ \t]*[0-9]*\n { - parseLineAndFile(yytext); + parseLineAndFile(yytext); } ^#[ \t]*ident.*\n { - /* ignore cpp ident */ - idlc()->incLineNumber(); + /* ignore cpp ident */ + idlc()->incLineNumber(); } ^#[ \t]*pragma[ \t].*\n { /* remember pragma */ - idlParsePragma(yytext); - idlc()->incLineNumber(); + idlParsePragma(yytext); + idlc()->incLineNumber(); } %% |