congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ProgramI
Code IndexAdd Tabnine to your IDE (free)

How to use
ProgramI
in
jplag

Best Java code snippets using jplag.ProgramI (Showing top 19 results out of 315)

origin: jplag/jplag

public static boolean scanFile(File dir, String fileName,
  jplag.cpp.CPPScanner scanner, jplag.cpp.Scanner scannerX)
{
  try {
    InputStream in = new NewlineStream(
      new FileInputStream(new File(dir,fileName)));
     if (scanner==null) {
      scanner = new CPPScanner(in);
     } else {
      scanner.ReInit(in);
     }
     scanner.scanner2=scannerX;
  } catch (FileNotFoundException e) {
     System.out.println("C/C++ Scanner:  File " + fileName + " not found.");
     return false;
  }
  try {
     scanner.scan();
  } catch (ParseException e) {
     scannerX.getProgram().addError("  Parsing Error in '" + fileName + "':\n  " + e.getMessage() + "\n");
     return false;
  } catch (TokenMgrError e) {
     scannerX.getProgram().addError("  Scanning Error in '" + fileName + "':\n  " + e.getMessage() + "\n");
     return false;
  }
  return true;
}
origin: jplag/jplag

public void outOfSerials() {
  if (runOut)
    return;
  runOut = true;
  errors++;
  program.print("ERROR: Out of serials!", null);
  System.out.println("jplag.text.Parser: ERROR: Out of serials!");
}
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new Structure();
  errors = 0;
  for (int i = 0; i < files.length; i++) {
    getProgram().print(null, "Parsing file " + files[i] + "\n");
    if (!parseFile(dir, files[i]))
      errors++;
    struct.addToken(new CharToken(FILE_END, files[i], this));
  }
  //System.err.println(struct.toString());
  if (errors == 0)
    program.print(null, "OK");
  else
    program.print(null, errors + " ERROR" + (errors > 1 ? "S" : ""));
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

public boolean parseFile(File dir, String file) {
  BufferedInputStream fis;
  ANTLRInputStream input;
  try {
    fis = new BufferedInputStream(new FileInputStream(new File(dir, file)));
    currentFile = file;
    input = new ANTLRInputStream(fis);
    // create a lexer that feeds off of input CharStream
    Java7Lexer lexer = new Java7Lexer(input);
    // create a buffer of tokens pulled from the lexer
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    // create a parser that feeds off the tokens buffer
    Java7Parser parser = new Java7Parser(tokens);
    CompilationUnitContext cuc = parser.compilationUnit();
    ParseTreeWalker ptw = new ParseTreeWalker();
    for (int i = 0; i < cuc.getChildCount(); i++) {
      ParseTree pt = cuc.getChild(i);
      ptw.walk(new JplagJava7Listener(this), pt);
    }
  } catch (IOException e) {
    getProgram().addError("Parsing Error in '" + file + "':\n" + e.getMessage() + "\n");
    return false;
  }
  return true;
}
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new jplag.Structure();
  errors = 0;
  JavaParser parser = null;// no worry it will be reinitialized
  // in method parseFile(...)
  for (int i = 0; i < files.length; i++) {
    actFile = files[i];
    getProgram().print(null, "Parsing file " + files[i] + "\n");
    if (!JavaParser.parseFile(dir, files[i], parser, this))
      errors++;
    struct.addToken(new JavaToken(FILE_END, actFile, 0));
  }
  // System.err.println(struct.toString());
  if (errors == 0)
    program.print(null, "OK\n");
  else
    program.print(null, errors + " ERRORS\n");
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

public static boolean parseFile(File dir, String fileName,jplag.javax.JavaParser parser,jplag.javax.Parser parserX) {
 File file=null;
 try {
  FileInputStream in = new FileInputStream(file=new File(dir,fileName));
  if (parser==null) {
   parser = new JavaParser(in);
  } else {
   parser.ReInit(in);
  }
   parser.parser2=parserX;
 } catch (FileNotFoundException e) {
  System.out.println("Java EXPERIMENTAL Parser Version 1.1:  File "+
            fileName +" not found.");
  return false;
 }
 try {
  parser.CompilationUnit();
 } catch (ParseException e) {
  parserX.getProgram().addError("  Parsing Error in '" + fileName + "':\u005cn  "
       + e.getMessage() + "\u005cn");
  return false;
 } catch (TokenMgrError e) {
  parserX.getProgram().addError("  Scanning Error in '" + fileName
       + "':\u005cn  " + e.getMessage() + "\u005cn");
  return true; //false;		// TODO: Why has this been manually set to true?
 }
 return true;
}
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new Structure();
  errors = 0;
  for (int i = 0; i < files.length; i++) {
    getProgram().print(null, "Parsing file " + files[i] + "\n");
    if (!parseFile(dir, files[i]))
      errors++;
    System.gc();//Emeric
    struct.addToken(new JavaToken(FILE_END, files[i], -1, -1, -1));
  }
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

public static boolean parseFile(File dir, String fileName,
  SchemeParser parser,jplag.scheme.Parser parserX)
{
  File file=null;
  try {
    FileInputStream in = new FileInputStream(file=new File(dir,fileName));
    if (parser==null) {
      parser = new SchemeParser(in);
    } else {
      parser.ReInit(in);
    }
    parser.parser2=parserX;
  } catch (FileNotFoundException e) {
    System.out.println("Scheme Parser R4RS:  File " + fileName +
      " not found.");
    return false;
  }
  try {
    parser.Program();
  } catch (ParseException e) {
    parserX.getProgram().addError("  Parsing Error in '" + fileName
      + "':\n  " + e.getMessage() + "\n");
    return false;
  } catch (TokenMgrError e) {
    parserX.getProgram().addError("  Scanning Error in '" + fileName
      + "':\n  " + e.getMessage() + "\n");
    return false;
  }
  return true;
}
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new Structure();
  errors = 0;
  for (int i = 0; i < files.length; i++) {
    getProgram().print(null, "Parsing file " + files[i] + "\n");
    if (!parseFile(dir, files[i]))
      errors++;
    System.gc();//Emeric
    struct.addToken(new JavaToken(FILE_END, files[i], -1, -1, -1));
  }
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

public boolean parseFile(File dir, String file) {
  BufferedInputStream fis;
  ANTLRInputStream input;
  try {
    fis = new BufferedInputStream(new FileInputStream(new File(dir, file)));
    currentFile = file;
    input = new ANTLRInputStream(fis);
    // create a lexer that feeds off of input CharStream
    Python3Lexer lexer = new Python3Lexer(input);
    // create a buffer of tokens pulled from the lexer
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    // create a parser that feeds off the tokens buffer
    Python3Parser parser = new Python3Parser(tokens);
    File_inputContext in = parser.file_input();
    ParseTreeWalker ptw = new ParseTreeWalker();
    for (int i = 0; i < in.getChildCount(); i++) {
      ParseTree pt = in.getChild(i);
      ptw.walk(new JplagPython3Listener(this), pt);
    }
  } catch (IOException e) {
    getProgram().addError("Parsing Error in '" + file + "':\n" + e.getMessage() + "\n");
    return false;
  }
  return true;
}
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new Structure();
  errors = 0;
  for (int i = 0; i < files.length; i++) {
    getProgram().print(null, "Parsing file " + files[i] + "\n");
    if (!parseFile(dir, files[i])) {
      errors++;
    }
    System.gc();//Emeric
    struct.addToken(new Python3Token(FILE_END, files[i], -1, -1, -1));
  }
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

  parser.CompilationUnit();
} catch (ParseException e) {
  parserX.getProgram().addError("  Parsing Error in '" + fileName + "':\n  " + e.getMessage() + "\n");
  return false;
} catch (TokenMgrError e) {
  parserX.getProgram().addError("  Scanning Error in '" + fileName + "':\n  " + e.getMessage() + "\n");
  return false;
} catch (Exception e) {
  parserX.getProgram().addError("  General error in '" + fileName + "':\n  " + e.getMessage() + "\n");
  e.printStackTrace();
  return false;
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new jplag.Structure();
  errors = 0;
  SchemeParser parser = null;// no worry it will be reinitialized
  // in method parseFile(...)
  for (int i = 0; i < files.length; i++) {
    actFile = files[i];
    getProgram().print(null, "Parsing file " + files[i] + "\n");
    if (!SchemeParser.parseFile(dir, files[i], parser, this))
      errors++;
    struct.addToken(new SchemeToken(FILE_END, actFile, 1));
  }
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

public boolean parseFile(File dir, String file) {
  InputState inputState = null;
  try {
    FileInputStream fis = new FileInputStream(new File(dir, file));
    currentFile = file;
    // Create a scanner that reads from the input stream passed to us
    inputState = new InputState(fis);
    TextLexer lexer = new TextLexer(inputState);
    lexer.setFilename(file);
    lexer.setTokenObjectClass("jplag.ParserToken");
    // Create a parser that reads from the scanner
    TextParser parser = new TextParser(lexer);
    parser.setFilename(file);
    parser.parser = this;// Added by Emeric 26.01.05 BAD
    // start parsing at the compilationUnit rule
    parser.file();
    // close file
    fis.close();
  } catch (Exception e) {
    getProgram().addError("  Parsing Error in '" + file +
        "' (line " + (inputState != null ? "" + inputState.getLine()
        : "") + "):\n  " + e.getMessage());
    return false;
  }
  return true;
}
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new jplag.Structure();
  errors = 0;
  JavaParser parser = null; // This will be (re)initialised in parseFile()
  for (int i = 0; i < files.length; i++) {
    actFile = files[i];
    getProgram().print(null, "Parsing file " + files[i] + "\n");
    if (!JavaParser.parseFile(dir, files[i], parser, this))
      errors++;
    struct.addToken(new JavaToken(FILE_END, actFile, -1, -1, -1));
  }
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

private boolean parseFile(File dir, String file) {
  try {
    FileInputStream fis = new FileInputStream(new File(dir, file));
    currentFile = file;
    // Create a scanner that reads from the input stream passed to us
    CSharpLexer lexer = new CSharpLexer(new UnicodeReader(fis, "UTF-8"));
    lexer.setFilename(file);
    lexer.setTabSize(1);
    // Create a parser that reads from the scanner
    CSharpParser parser = new CSharpParser(lexer);
    parser.setFilename(file);
    parser.parser = this;//Added by emeric 22.01.05
    // start parsing at the compilationUnit rule
    parser.compilation_unit();
    // close file
    fis.close();
  } catch (Exception e) {
    getProgram().addError("  Parsing Error in '" + file + "':\n  " + e.toString() + "\n");
    return false;
  }
  return true;
}
origin: jplag/jplag

public jplag.Structure scan(File dir, String files[]) {
  struct = new jplag.Structure();
  errors = 0;
  CPPScanner scanner = null;// will be initialized in Method scanFile
  for (int i = 0; i < files.length; i++) {
    actFile = files[i];
    getProgram().print(null, "Scanning file " + files[i] + "\n");
    if (!CPPScanner.scanFile(dir, files[i], scanner, this))
      errors++;
    struct.addToken(new CPPToken(FILE_END, actFile, 1));
  }
  this.parseEnd();
  return struct;
}
origin: jplag/jplag

public boolean parseFile(File dir, String file) {
  InputState inputState = null;
  try {
    FileInputStream fis = new FileInputStream(new File(dir, file));
    currentFile = file;
    // Create a scanner that reads from the input stream passed to us
    inputState = new InputState(fis);
    JLexer lexer = new JLexer(inputState);
    lexer.setFilename(file);
    lexer.setTokenObjectClass("jplag.ParserToken");
    // Create a parser that reads from the scanner
    JRecognizer parser = new JRecognizer(lexer);
    parser.setFilename(file);
    parser.parser = this;
    // start parsing at the compilationUnit rule
    parser.compilationUnit();
    // close file
    fis.close();
  } catch (Exception e) {
    getProgram().addError(
        "  Parsing Error in '" + file + "':\n" + "  Parse error at line "
            + (inputState != null ? "" + inputState.getLine() : "UNKNOWN") + ", column "
            + (inputState != null ? "" + inputState.tokColumn : "UNKNOWN") + ": " + e.getMessage() + "\n");
    return false;
  }
  return true;
}
origin: jplag/jplag

public jplag.Structure parse(File dir, String files[]) {
  struct = new Structure();
  errors = 0;
  for (int i = 0; i < files.length; i++) {
    getProgram().print("", "Parsing file " + files[i] + "\n");
    if (!parseFile(dir, files[i]))
      errors++;
    struct.addToken(new TextToken(FILE_END, files[i], this));
  }
  Structure tmp = struct;
  struct = null;
  this.parseEnd();
  return tmp;
}
jplagProgramI

Most used methods

  • addError
  • print

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • Kernel (java.awt.image)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Path (java.nio.file)
  • Permission (java.security)
    Legacy security code; do not use.
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now