Package lupos.gui.anotherSyntaxHighlighting

Examples of lupos.gui.anotherSyntaxHighlighting.ILuposToken


   * QUALIFIEDURI, VARIABLE, PREFIXLABEL, URI
   */
  public List<Item> tokensToList(final LuposDocumentReader r, final ILuposParser p, final int indexBeforeCurrentWord) {
    final String content = r.getText().substring(0, indexBeforeCurrentWord);
    p.setReaderTokenFriendly(r, 0, content.length());
    ILuposToken token;
    final List<Item> tokensList = new ArrayList<Item>();
    while ((token = p.getNextToken(content)) != null) {
      final String[] splittedTokenLine = token.toString().split(" ");
      if ((splittedTokenLine[2].equals("QUALIFIEDURI") || splittedTokenLine[2]
          .equals("VARIABLE") || splittedTokenLine[2].equals("PREFIXLABEL")|| splittedTokenLine[2].equals("URI"))
          && !(tokensList.contains(splittedTokenLine[9]))) {
        tokensList.add(new Item(splittedTokenLine[9], true));
      }
View Full Code Here


    }
    if (description != null) {
      final String content = r.getText().substring(0,
          indexBeforeCurrentWord);
      p.setReaderTokenFriendly(r, 0, content.length());
      ILuposToken token;
      String[] splittedToken;
      while ((token = p.getNextToken(content)) != null) {
        splittedToken = token.toString().split(" ");
        if (splittedToken[2].equals(description)
            && !(arrayList.contains(splittedToken[9]))) {
          arrayList.add(new Item(splittedToken[9], true));

        }
View Full Code Here

    // end of file reached
    if (this.eof == true)
      return null;

    TOKEN sparql1_1token = null;
    ILuposToken token = null;

    int beginChar = (this.currentToken!=null)?
        this.currentToken.getBeginChar() + this.currentToken.getContents().length() - 1 :
        this.beginCharOffset - 1;
   
    // catch thrown error if unknown token exists
    try {
      // Get the token from the SPARQL 1.1 parser
      sparql1_1token = this.parser.getNextToken();
           
      //sparql 1.1 parser return eof flag
      if (sparql1_1token.getKind() == 0) {
        token = testOfComment(content, beginChar + 1, content.length());
        if(token!=null){
          this.currentToken = token;
          return token;
        }
        setEOF(true);
        return null;
      }
     
      final int startOfBeginChar = beginChar + 1;
     
      // Generate a LuposToken by using the given SPARQL 1.1 token
      final String image = sparql1_1token.getImage();
      final int imageLength = image.length();
      char firstChar = image.charAt(0);
      // determine real start of the token...
      do {
        beginChar++;
        while(beginChar<content.length() && content.charAt(beginChar)!=firstChar){
          beginChar++;
        }
      } while((beginChar + imageLength < content.length()) && content.substring(beginChar, beginChar + imageLength).compareTo(image)!=0);
     
      token = testOfComment(content, startOfBeginChar, beginChar);
     
      if(token == null){
        token = this.parser.create(this.TOKEN_MAP[sparql1_1token.getKind()], image, beginChar);
      } else {
        setReader(this.stream, token.getBeginChar() + token.getContents().length(), this.endCharOffset);
      }
     
    } catch (Error e) {
      token = errorHandling(beginChar, content);
    }
View Full Code Here

    return token;
  }
 
  private ILuposToken errorHandling(final int beginCharParameter, final String content){
    int beginChar=beginCharParameter+1;
    ILuposToken token = testOfComment(content, beginChar, content.length());
    if(token!=null){
      setReader(this.stream, token.getBeginChar() + token.getContents().length(), this.endCharOffset);
    } else {
      int index = 0;
      boolean flag = false;
      do{
        try{
View Full Code Here

    }
    if (description != null) {
      final String content = r.getText().substring(0,
          indexBeforeCurrentWord);
      p.setReaderTokenFriendly(r, 0, content.length());
      ILuposToken token;
      String[] splittedToken;
      String tokenElement;
      int pos;
      while ((token = p.getNextToken(content)) != null) {
        splittedToken = token.toString().split(" ");
        if (!splittedToken[2].equals("ERROR")) {
          if (!splittedToken[9].startsWith("\"")) {
            tokenElement = splittedToken[9].toLowerCase();
          } else {
            pos = token.toString().indexOf("\"");
            tokenElement = token
                .toString()
                .substring(pos,
                    token.toString().length())
                .toLowerCase();
          }
          if (splittedToken[2].equals(description)
              && !(arrayList.contains(tokenElement))) {
            arrayList.add(new Item(tokenElement, true));
View Full Code Here

    if (description != null) {
      final String content = r.getText().substring(0,
          indexBeforeCurrentWord);
      p = new RIFParserHelper(p);
      p.setReaderTokenFriendly(r, 0, content.length());
      ILuposToken token;
      String[] splittedToken;
      while ((token = p.getNextToken(content)) != null) {
        splittedToken = token.toString().split(" ");
        if (splittedToken[2].equals(description)
            && !(arrayList.contains(splittedToken[9]))) {
          arrayList.add(new Item(splittedToken[9], true));
        }
      }
View Full Code Here

   * durchsucht das Dokument nach validen Bezeichnern
   */
  public void setExistingIdentifier(final String hashmapKey, final String description, final LuposDocumentReader r, final ILuposParser p){
    final String content = r.getText();
    p.setReaderTokenFriendly(r, 0, content.length());
    ILuposToken token;
    String[] splittedToken;
    boolean exists = false;
    while ((token = p.getNextToken(content))!= null) {
      splittedToken = token.toString().split(" ");
      if (splittedToken[2].equals(description)) {
        this.hashmap.put(hashmapKey, splittedToken[9]);
        exists = true;
        break;
      }
View Full Code Here

  }

  @Override
  public ILuposToken getNextToken(String content) {
    if (this.token != null) {
      ILuposToken iToken = this.token;
      this.token = null;
      return iToken;
    }
    ILuposToken current = this.parser.getNextToken(content);
    if (current == null
        || current.getDescription() != TYPE__SemanticWeb.VARIABLE) {
      return current;
    }
    ILuposToken next = this.parser.getNextToken(content);
    if (next == null
        || next.getDescription() != TYPE__SemanticWeb.IDENTIFIER) {
      this.token = next;
      return current;
    }
    return current.create(
        TYPE__SemanticWeb.VARIABLE,
        content.substring(current.getBeginChar(), next.getBeginChar()
            + next.getContents().length()), current.getBeginChar());
  }
View Full Code Here

  public HashMap<Item, Integer> tokensToMap(final LuposDocumentReader r,
      final ILuposParser p, final int indexBeforeCurrentWord) {
    final HashMap<Item, Integer> hashmap = new HashMap<Item, Integer>();
    final String content = r.getText().substring(0, indexBeforeCurrentWord);
    p.setReaderTokenFriendly(r, 0, content.length());
    ILuposToken token;
    while ((token = p.getNextToken(content)) != null) {

      final String[] splittedTokenLine = token.toString().split(" ");
      int hashTemp;
      final String semanticWebType = splittedTokenLine[2];

      if ((splittedTokenLine[2].equals("QUALIFIEDURI")
          || splittedTokenLine[2].equals("VARIABLE")
View Full Code Here

TOP

Related Classes of lupos.gui.anotherSyntaxHighlighting.ILuposToken

Copyright © 2018 www.massapicom. 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.