Tabnine Logo
ProgramI.addError
Code IndexAdd Tabnine to your IDE (free)

How to use
addError
method
in
jplag.ProgramI

Best Java code snippets using jplag.ProgramI.addError (Showing top 9 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 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 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 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 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

  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

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 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 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;
}
jplagProgramIaddError

Popular methods of ProgramI

  • print

Popular in Java

  • Parsing JSON documents to java classes using gson
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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