Examples of Token


Examples of org.codehaus.jparsec.Token

public class TerminalParserTest extends TestCase {
 
  public void testParse() {
    assertParser(TerminalParser.term("."),
        "  . /** javadoc */ /* regular doc */ \n // line comment",
        new Token(2, 1, Tokens.reserved(".")));
  }
View Full Code Here

Examples of org.crsh.cli.impl.tokenizer.Token

  static class ReadingOption extends Status {

    <T> Response<T> process(Request<T> req) {
      Response<T> response = new Response<T>();
      Token token = req.tokenizer.peek();
      if (token == null) {
        response.add(new Event.Stop.Done(req.tokenizer.getIndex()));
      } else if (token instanceof Token.Whitespace) {
        response.add(new Event.Separator((Token.Whitespace) token));
        req.tokenizer.next();
      } else {
        Token.Literal literal = (Token.Literal)token;
        if (literal instanceof Token.Literal.Option) {
          Token.Literal.Option optionToken = (Token.Literal.Option)literal;
          if (optionToken.getName().length() == 0 && optionToken instanceof Token.Literal.Option.Long) {
            req.tokenizer.next();
            if (req.tokenizer.hasNext()) {
              response.status = new Status.WantReadArg();
            } else {
              if (req.mode == Mode.INVOKE) {
                response.status = new Status.Done();
                response.add(new Event.Stop.Done(req.tokenizer.getIndex()));
              } else {
                response.add(new Event.Stop.Unresolved.NoSuchOption(optionToken));
              }
            }
          } else {
            OptionDescriptor desc = req.command.resolveOption(literal.getValue());
            if (desc != null) {
              req.tokenizer.next();
              int arity = desc.getArity();
              LinkedList<Token.Literal.Word> values = new LinkedList<Token.Literal.Word>();
              while (arity > 0) {
                if (req.tokenizer.hasNext()) {
                  Token a = req.tokenizer.peek();
                  if (a instanceof Token.Whitespace) {
                    req.tokenizer.next();
                    if (req.tokenizer.hasNext() && req.tokenizer.peek() instanceof Token.Literal.Word) {
                      // ok
                    } else {
View Full Code Here

Examples of org.crsh.lang.impl.script.Token

    return commandContext.releaseAlternateBuffer();
  }

  public CommandInvoker<?, ?> resolve(String s) throws CommandException {
    CRaSHSession session = (CRaSHSession)getSession();
    Token token2 = Token.parse(s);
    try {
      PipeLineFactory factory = token2.createFactory();
      return factory.create(session);
    }
    catch (CommandNotFoundException e) {
      throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e);
    }
View Full Code Here

Examples of org.dmd.util.parsing.Token

        while(it.hasNext()){
            StringName  key         = it.next();
            String  firstChar   = key.getNameString().substring(0,1).toUpperCase();
            TreeMap<String,Token> charTree    = index.get(firstChar);

            charTree.put(key.getNameString().toUpperCase(), new Token(key.getNameString(),0,schema.allDefs.get(key)));
        }

        // Generate the index reference header in HTML format - this will be
        // placed at the top of each index page.
        sb.append("<P> <HR SIZE=3 NOSHADE>");
        sb.append("<TABLE>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> <A HREF=\"index-allSchemas.shtml\"> Schema Summary </A></TD><TD></TD> </tr>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> <A HREF=\"classHierarchy.shtml\"> Class Hierarchy </A></TD><TD></TD> </tr>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> <A HREF=\"instanceHierarchy.shtml\"> Instance Hierarchy </A></TD><TD></TD> </tr>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> Definitions Index </TD> <TD>\n");

        Iterator<String> indexIT = index.keySet().iterator();
        while(indexIT.hasNext()){
            String key = indexIT.next();
            TreeMap<String,Token>     tm = index.get(key);
//            String      fn = new String(dir + File.separator + "index-" + key + ".shtml");

            if (tm.size() > 0){
                sb.append("<A HREF=\"index-" + key + ".shtml\">" + key + "</A> \n");
            }
            else{
                sb.append(key + "  ");
            }
        }
        sb.append("</TD> </tr> </TABLE> <HR SIZE=3 NOSHADE> <P>\n");
        indexRefHTML = sb.toString();

        // Generate the schema summary
        try {
            BufferedWriter out = new BufferedWriter(new FileWriter(dir + "/index-allSchemas.shtml"));

            out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n");
            out.write("        \"http://www.w3.org/TR/REC-html40\">\n");
            out.write("<HTML>\n");
            out.write("<HEAD>\n");
            out.write("<LINK href=\"/standard.css\" rel=\"stylesheet\" type=\"text/css\">\n");
            out.write("<TITLE> " + organization + " - Schema Summary </TITLE>\n");
            out.write("</HEAD>\n");
            out.write("<BODY BGCOLOR=\"FFFFFF\">\n\n");

            // The whole page is in a table
            out.write("<TABLE WIDTH=600 CELLPADDING=10> <tr>\n");

            out.write("<TD WIDTH=120 CLASS=\"sidebar2\" VALIGN=TOP>\n");
//            out.write("<!--#include virtual=\"navLinks.html\" --> <P> </TD>\n");

            out.write("<TD>\n\n");

            out.write("<P CLASS=\"pagehead\">" + organization + " Schema Summary\n");
            out.write(indexRefHTML);
            // out.write("<H2> Schema Summary </H2> <P>");

            out.write("<TABLE>\n");

            Iterator<SchemaDefinition> schemaIT= schema.getSchemas();
            while(schemaIT.hasNext()){
                SchemaDefinition sd = schemaIT.next();

                out.write("<tr> <TD VALIGN=TOP CLASS=\"pagetextUnjust\">\n");
                out.write(schemaLink(sd));
                out.write("</TD> <TD CLASS=\"pagetextUnjust\">\n");
                out.write(sd.getDescription());
                out.write("</TD> </tr>");
            }

            out.write("</TABLE>");

            out.write("</TD> </tr> </TABLE>");
            out.write("</BODY>\n");
            out.write("</HTML>\n");

            out.close();
        } catch (IOException e) {
            System.out.println("IO Error:\n" + e);
        }


        indexIT = index.keySet().iterator();
        while(it.hasNext()){
            String key = indexIT.next();
            TreeMap<String,Token>     tm = index.get(key);
            String      fn = new String(dir + File.separator + "index-" + key + ".shtml");

            if (tm.size() > 0){
                try {
                    BufferedWriter out = new BufferedWriter(new FileWriter(fn));
                    Iterator<Token> defsIt = tm.values().iterator();

                    System.out.println("Generating index - " + fn);

                    out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n");
                    out.write("        \"http://www.w3.org/TR/REC-html40\">\n");
                    out.write("<HTML>\n");
                    out.write("<HEAD>\n");
                    out.write("<LINK href=\"/standard.css\" rel=\"stylesheet\" type=\"text/css\">\n");
                    out.write("<TITLE> " + organization + " - Schema Definitions Starting With The Letter - " + key + "</TITLE>\n");
                    out.write("</HEAD>\n");
                    out.write("<BODY BGCOLOR=\"FFFFFF\">\n\n");

                    // The whole page is in a table
                    out.write("<TABLE WIDTH=600 CELLPADDING=10> <tr> \n");

                    out.write("<TD WIDTH=120 CLASS=\"sidebar2\" VALIGN=TOP>\n");
//                    out.write("<!--#include virtual=\"navLinks.html\" --> <P> </TD>\n");

                    out.write("<TD>\n\n");
                    out.write(indexRefHTML);
                    out.write("<H1> - " + key + " - </H1> <P>");

                    out.write("<TABLE>\n");

                    while(defsIt.hasNext()){
                        Token               t  = (Token)defsIt.next();
                        DmsDefinition    go = (DmsDefinition) t.getUserData();

                        out.write("<tr> <TD VALIGN=TOP>\n");

                        if (go instanceof AttributeDefinition){
                            AttributeDefinition ad = (AttributeDefinition)go;
                            if (schema.attrAbbrevs.get(t.getValue()) != null){
                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
                                out.write("the abbreviated name of the " + defLink(ad,null) + " attribute of type " + defLink(ad.getType(),null) + " from the " + schemaLink(ad.getDefinedIn()) + " schema");
                            }
//                            else if (schema.reposNames.get(tname) != null){
//                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
//                                out.write("the repository name of the " + defLink(ad,null) + " attribute of type " + defLink(ad.getType(),null) + " from the " + schemaLink(ad.getDefinedIn()) + " schema");
//                            }
                            else{
                                out.write(defLink(go,null) + "</TD> <TD>\n");
                                out.write(" an attribute of type " + defLink(ad.getType(),null) + " from the " + schemaLink(ad.getDefinedIn()) + " schema");
                            }
                        }
                        else if (go instanceof ClassDefinition){
                            ClassDefinition cd = (ClassDefinition)go;
                            if (schema.attrAbbrevs.get(t.getValue()) != null){
                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
                                out.write("the abbreviated name of the " + defLink(cd,null) + " class from the " + schemaLink(cd.getDefinedIn()) + " schema");
                            }
//                            else if (schema.reposNames.get(t.getValue()) != null){
//                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
//                                out.write("the repository name of the " + defLink(cd,null) + " class from the " + schemaLink(cd.getDefinedIn()) + " schema");
View Full Code Here

Examples of org.eclipse.jface.text.rules.Token

        try {
          int partOffset = currentToken.getOffset() - 1;
          if (partOffset >= 0) {
            ITypedRegion region = _document.getPartition(partOffset);
            if (region != null) {
              previousToken = new TokenBean(new Token(region.getType()), region.getLength(), region.getOffset());
            }
          }
        } catch (BadLocationException e) {
        }
      }
View Full Code Here

Examples of org.eclipse.jst.jsp.core.internal.java.jspel.Token

      elParser.Expression();
    }
    catch (ParseException e) {
      int sev = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_EL_SYNTAX);
      if (sev != ValidationMessage.IGNORE) {
        Token curTok = e.currentToken;
        int problemStartOffset = contentDocStart + curTok.beginColumn;
        Message message = new LocalizedMessage(sev, JSPCoreMessages.JSPEL_Syntax);
        message.setOffset(problemStartOffset);
        message.setLength(curTok.endColumn - curTok.beginColumn + 1);
        message.setTargetObject(file);
View Full Code Here

Examples of org.eclipse.persistence.internal.libraries.antlr.runtime.Token

    Tree t = (Tree)create(fromToken);
    return t;
  }

  public Object create(int tokenType, String text) {
    Token fromToken = createToken(tokenType, text);
    Tree t = (Tree)create(fromToken);
    return t;
  }
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentParser.Token

    private IndexRequest parseObject(String line) throws ObjectImportException {
        XContentParser parser = null;
        try {
            IndexRequest indexRequest = new IndexRequest();
            parser = XContentFactory.xContent(line.getBytes()).createParser(line.getBytes());
            Token token;
            XContentBuilder sourceBuilder = XContentFactory.contentBuilder(XContentType.JSON);
            long ttl = 0;
            while ((token = parser.nextToken()) != Token.END_OBJECT) {
                if (token == XContentParser.Token.FIELD_NAME) {
                    String fieldName = parser.currentName();
View Full Code Here

Examples of org.elasticsearch.hadoop.serialization.Parser.Token

        if (value == null || isEmpty(value)) {
            return nullValue();
        }
        else {
            Token tk = parser.currentToken();

            if (tk == Token.VALUE_BOOLEAN) {
                val = parser.booleanValue();
            }
            else {
View Full Code Here

Examples of org.exoplatform.web.security.Token

            if (!newpassword.equals(confirmnewpassword)) {
                uiApp.addMessage(new ApplicationMessage("UIResetPassword.msg.password-is-not-match", null));
                setPassword = false;
            }

            Token token = tokenService.deleteToken(uiForm.getTokenId());
            if (token == null || token.isExpired()) {
                uiApp.addMessage(new ApplicationMessage("UIForgetPassword.msg.expration", null));
                setPassword = false;
            }

            if (setPassword) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.