Tabnine Logo
Ast
Code IndexAdd Tabnine to your IDE (free)

How to use
Ast
in
net.razorvine.serpent.ast

Best Java code snippets using net.razorvine.serpent.ast.Ast (Showing top 6 results out of 315)

origin: jpmml/jpmml-sklearn

static
private Map<String, ?> parseDict(String string){
  Parser parser = new Parser();
  Ast ast = parser.parse(string);
  return (Map<String, ?>)ast.getData();
}
origin: net.razorvine/serpent

/**
 * get the actual data as Java objects.
 * @param dictConverter object to convert dicts to actual instances for a class,
 *   instead of leaving them as dictionaries. Requires the __class__ key to be present
 *   in the dict node. If it returns null, the normal processing is done.
 */
public Object getData(IDictToInstance dictConverter)
{
  ObjectifyVisitor v = new ObjectifyVisitor(dictConverter);
  this.accept(v);
  return v.getObject();
}
origin: net.razorvine/serpent

/**
 * Parse from a string with the Python literal expression
 */
public Ast parse(String expression)
{
  Ast ast=new Ast();
  if(expression==null || expression.length()==0)
    return ast;
  
  SeekableStringReader sr = new SeekableStringReader(expression);
  if(sr.peek()=='#')
    sr.readUntil('\n');  // skip comment line
  
  try {
    ast.root = parseExpr(sr);
    sr.skipWhitespace();
    if(sr.hasMore())
      throw new ParseException("garbage at end of expression");
    return ast;
  } catch (ParseException x) {
    String faultLocation = extractFaultLocation(sr);
    throw new ParseException(x.getMessage() + " (at position "+sr.bookmark()+"; '"+faultLocation+"')", x);
  }
}
 
origin: net.razorvine/pyrolite

@Override
public Object deserializeData(byte[] data) throws IOException {
  Parser p = new Parser();
  Ast ast = p.parse(data);
  IDictToInstance dictConverter = new DictConverter();
  return ast.getData(dictConverter);
}

origin: net.razorvine/serpent

/**
 * get the actual data as Java objects.
 */
public Object getData()
{
  ObjectifyVisitor v = new ObjectifyVisitor();
  this.accept(v);
  return v.getObject();
}
origin: org.spark-project/pyrolite

@Override
public Object deserializeData(byte[] data) throws IOException {
  Parser p = new Parser();
  Ast ast = p.parse(data);
  IDictToInstance dictConverter = new DictConverter();
  return ast.getData(dictConverter);
}

net.razorvine.serpent.astAst

Javadoc

Abstract syntax tree for the literal expression. This is what the parser returns.

Most used methods

  • getData
    get the actual data as Java objects.
  • <init>
  • accept

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • getSystemService (Context)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • JOptionPane (javax.swing)
  • Top PhpStorm plugins
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