static bool isMethodCall( SourceTokenizer& tokenizer ) { bool ret = false; Sequence<SourceToken> tokens; tokens.addLast( tokenizer.nextToken() ); bool loop = true; while ( loop && tokenizer.hasMoreTokens() ) { SourceToken* token = tokenizer.nextToken(); const String& value = token->getValue(); SourceToken::TokenType type = token->getTokenType(); switch ( type ) { case SourceToken::WORD: case SourceToken::SPACE: break; case SourceToken::STARTEXPRESSION: ret = true; loop = false; break; case SourceToken::INFIXOP: if ( ! (value.contentEquals( "<" ) || value.contentEquals( ">" )) ) loop = false; break; case SourceToken::SYMBOL: if ( !value.contentEquals( "," ) ) loop = false; break; default: loop = false; } tokens.addLast( token ); } pushbackTokens( tokenizer, tokens ); return ret; }
static void run( int argc, char** argv ) { Sequence<Path> paths; for ( int i=1; i < argc; i++ ) { paths.addLast( new Path( argv[i] ) ); } CodeBase* codebase = AstralFactory::createAstralExport( paths, ".java" ); { Export::toXML( *codebase ); } delete codebase; }
bool parseArguments( int argc, const char** argv, Sequence<String>& fileLocations, MTArguments& arguments ) { if ( argc <= 1 ) return false; String* executable = new String( basename( (char*) argv[0] ) ); for ( int i=1; i < argc; i++ ) { String arg( argv[i] ); if ( arg.equals( "--style" ) ) { i++; if ( i < argc ) { arguments.stylesheet = argv[i]; } } else if ( arg.equals( "--format" ) ) { i++; if ( i < argc ) { arguments.format = argv[i]; } } else if ( arg.equals( "--out" ) ) { i++; if ( i < argc ) { arguments.outfile = argv[i]; } } else if ( arg.equals( "--class" ) ) { i++; if ( i < argc ) { arguments.classType = argv[i]; } } else if ( arg.equals( "--parameters" ) ) { i++; if ( i < argc ) { arguments.parameters = argv[i]; } } else if ( arg.equals( "--packages" ) ) { i++; if ( i < argc ) { arguments.packages = argv[i]; } } else if ( arg.equals( "--content-only" ) ) { if ( i < argc ) { arguments.contentOnly = argv[i]; } } else { fileLocations.addLast( new String( argv[i] ) ); } } if ( 0 == CharString_getLength( arguments.format ) ) { if ( executable->contentEquals( "max2tex" ) ) { arguments.format = "tex"; } else { arguments.format = "html"; } } if ( 0 != CharString_compare( arguments.outfile, "" ) ) { if ( ! CharString_endsWith( arguments.outfile, arguments.format ) ) { FormattedString fs( "%s.%s", arguments.outfile, arguments.format ); arguments.outfile = new_CharString( fs.getChars() ); } } if ( 0 == CharString_compare( arguments.classType, "" ) ) { arguments.classType = "article"; } delete executable; return true; }
bool parseArgumentsX( int argc, char** argv, Sequence<String>& fileLocations, String** outfile, String** stylesheet, String** format, String** classType ) { if ( argc <= 1 ) return false; String* executable = new String( (const char*) basename( argv[0] ) ); for ( int i=1; i < argc; i++ ) { String arg( argv[i] ); if ( arg.equals( "--style" ) ) { i++; if ( i < argc ) { delete *stylesheet; *stylesheet = new String( argv[i] ); } } else if ( arg.equals( "--format" ) ) { i++; if ( i < argc ) { delete *format; *format = new String( argv[i] ); } } else if ( arg.equals( "--out" ) ) { i++; if ( i < argc ) { delete *outfile; *outfile = new String( argv[i] ); } } else if ( arg.equals( "--class" ) ) { i++; if ( i < argc ) { delete *classType; *classType = new String( argv[i] ); } } else { fileLocations.addLast( new String( argv[i] ) ); } } if ( ! *format ) { if ( executable->contentEquals( "max2tex" ) ) { *format = new String( "tex" ); } else { *format = new String( "html" ); } } if ( *outfile && !(*outfile)->endsWith( **format ) ) { *outfile = new FormattedString( "%s.%s", (*outfile)->getChars(), (*format)->getChars() ); } if ( ! *classType ) { *classType = new String( "article" ); } delete executable; return true; }