Logo Search packages:      
Sourcecode: latexdraw version File versions  Download package

int latexDraw::parsers::pstricks::PSTricksParser::parse ( String  file,
JFrame  parent,
JProgressBar  progressBar 
) [inline]

Allows to parse a TeX file.

Parameters:
file The TeX code to parse.
parent The main frame: useful to display message dialog (can be equal to null: no message).
progressBar The progress bar of the parser. If null, it will not be used.

Definition at line 353 of file PSTricksParser.java.

References latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnArcWedge(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnBezierCurve(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnCircle(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnClosePathCommand(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnCurveTo(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnDiamondTriangle(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnDot(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnFramedBox(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnFrameEllipse(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnGridAxes(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnLine(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnLineTo(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnMoveTo(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnNewPath(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnPicture(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnPolygon(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnTerminatedFramedBoxes(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnterminatedPsCustom(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::actionsOnText(), latexDraw::parsers::Parser::CANCEL_PARSING, latexDraw::parsers::Parser::ERROR_PARSING, latexDraw::parsers::pstricks::PSTricksParameters::fromFramedBox, latexDraw::parsers::NotYetManagedException::getCommand(), latexDraw::parsers::UnknownCommandException::getCommand(), latexDraw::parsers::NotYetManagedException::getNLine(), latexDraw::parsers::UnknownCommandException::getNLine(), latexDraw::parsers::pstricks::PSTricksParameters::getPosition(), latexDraw::parsers::Parser::OK_PARSING, latexDraw::parsers::pstricks::PSTricksParameters::onRadians, latexDraw::parsers::pstricks::PSTricksParserActionsManager::parseDegreesCommand(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::parseOpenShadowCommand(), latexDraw::parsers::pstricks::PSTricksParserActionsManager::parsePsCustomCommand(), progressB, latexDraw::parsers::pstricks::PSTricksParameters::psBox, latexDraw::parsers::pstricks::PSTricksParameters::psBoxText, latexDraw::parsers::pstricks::PSTricksParameters::psCustomP, latexDraw::figures::Text::setText(), latexDraw::parsers::pstricks::PSTricksParameters::specialCoor, stopThread, testEndThread(), texParserActions, latexDraw::parsers::pstricks::PSTricksParameters::textBold, latexDraw::parsers::pstricks::PSTricksParameters::textColor, latexDraw::parsers::pstricks::PSTricksParameters::textEnc, latexDraw::parsers::pstricks::PSTricksParameters::textFamily, latexDraw::parsers::pstricks::PSTricksParameters::textForFrame, latexDraw::parsers::pstricks::PSTricksParameters::textItalic, latexDraw::parsers::pstricks::PSTricksParameters::textParsed, latexDraw::parsers::pstricks::PSTricksParameters::textSeries, latexDraw::parsers::pstricks::PSTricksParameters::textShape, latexDraw::parsers::pstricks::PSTricksParameters::textSize, latexDraw::parsers::FatalErrorParsingException::toString(), and updateBar().

      {
            try
            {
                  PSTricksParameters.reinitialize();
                  stopThread = false;
                  progressB = progressBar;
                  
                  /* *********************************************************************** */
                  /* We remove big spaces and comments */
                  
                  char eol = System.getProperty("line.separator").charAt(0);//$NON-NLS-1$
                  char[] f2 = new char[file.length()];
                  
                  int i=0, lgth = file.length(), cpt=0;
                  boolean zero = false;
                  while(i<lgth)
                  {
                        if(i<lgth && (file.charAt(i)==' ' || file.charAt(i)==9)) //9 = '\t'
                        {
                              if(!zero) 
                              {
                                    f2[cpt++] = ' ';
                                    zero=true;
                              }
                        }
                        else
                        {
                              if(file.charAt(i)=='%') 
                              {
                                    if(i>0)
                                          if(file.charAt(i-1)=='\\')
                                          {
                                                f2[cpt++] = file.charAt(i);
                                                zero = false;
                                          }
                                          else
                                          {
                                                while(i<lgth && eol!=file.charAt(i))
                                                      i++;
                                                
                                                if(i<lgth) f2[cpt++] = file.charAt(i);// We copy the eol
                                          }
                              }
                              else 
                              {
                                    f2[cpt++] = file.charAt(i);
                                    zero = false;
                              }
                        }
                        i++;
                  } // while(i<lgth)
                  
                  
                  String f = String.valueOf(f2, 0, cpt) + ' ';//We terminate the code by a space
                  
                  if(progressBar!=null)
                  {
                        progressB.setMinimum(0);
                        progressB.setMaximum(f.length());
                  }
                  
                  /* ********************************************************************/
                  Vector<PSTricksParameters> params = new Vector<PSTricksParameters>();
                  boolean started = false;
                  i = 0;
                  int i2;
                  lgth = f.length();
                  int nLine = 1;
                  Vector<ParserCmdMessage> parserMsgs = new Vector<ParserCmdMessage>();
                  boolean parsingFinished = false;
                  boolean lastTokenIsEOL = false, isFramedBox = false;
                  int iOld = i;
                  boolean startedWithBeginPs = true;
                  
                  while(i<lgth && !parsingFinished)
                  {
                        if(progressBar!=null) 
                        {
                              final int cpti = progressB.getValue()+i-iOld;
                              SwingUtilities.invokeAndWait(
                              new Runnable() { public void run() {updateBar(cpti);} });
                        }
                        
                        try {testEndThread(); }
                        catch(Exception e) { return CANCEL_PARSING;}
                        
                        iOld = i;
                        try
                        {
                        try
                        {
                              if(f.charAt(i)!=eol) lastTokenIsEOL = false;
                              
                              switch(f.charAt(i))
                              {
                                    case '$':
                                          i++;
                                          
                                          if(started)
                                          {
                                                PSTricksParameters p = params.lastElement();
                                                p.textParsed += '$';
                                                
                                                while(i<lgth && f.charAt(i)!='$')
                                                {
                                                      p.textParsed += f.charAt(i);
                                                      i++;
                                                }
                                                
                                                p.textParsed += '$';
                                          }
                                          else
                                                while(i<lgth && f.charAt(i)!='$')
                                                      i++;

                                          if(i>=lgth) throw new UnexceptedEndOfFileException();
                                          
                                          i++;
                                          break;
                                          
                                    case '\\' :
                                          // ********************** //
                                          /* Parsing of the command */
                                          
                                          i++;
                                          if(i>=lgth)  throw new UnexceptedEndOfFileException();
                                          
                                          switch(f.charAt(i))
                                          {
                                                case 'p' : 
                                                      i2 = i;
                                                      if(i+1>=lgth) 
                                                      {
                                                            if(started)  throw new UnexceptedEndOfFileException();
                                                            throw new IgnoreCommandException(nLine);
                                                      }
                                                      i++;
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 's' ://ps
                                                                  
                                                                  if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                  i++;
                                                                  switch(f.charAt(i))
                                                                  {
                                                                        case 'c' : // psc
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                              i++;
                                                                              
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'o' :// pscoil
                                                                                          if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='i' && f.charAt(++i)=='l' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                      throw new NotYetManagedException("pscoil", nLine);//$NON-NLS-1$
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                          
                                                                                    case 'i' : // psci 
                                                                                          if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          
                                                                                          if(f.charAt(++i)=='r' && f.charAt(++i)=='c' && f.charAt(++i)=='l' &&
                                                                                                f.charAt(++i)=='e') // pscircle
                                                                                          {
                                                                                                if(++i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                
                                                                                                if((f.charAt(i)<'a' || f.charAt(i)>'z') && 
                                                                                                (f.charAt(i)<'A' || f.charAt(i)>'Z'))//pscircle 
                                                                                                {
                                                                                                      int end = texParserActions.actionsOnCircle(nLine, f.charAt(i)=='*', 
                                                                                                                  params, f.substring(i, f.length()));
                                                                                                      if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                      if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                      if(f.charAt(i)=='b' && f.charAt(++i)=='o' && 
                                                                                                            f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                                            (f.charAt(i)<'A' || f.charAt(i)>'Z')) // pscriclebox
                                                                                                      {
                                                                                                            PSTricksParameters tp = params.lastElement();
                                                                                                            
                                                                                                            if(tp.psBox.isEmpty())
                                                                                                                  tp.psBoxText.setText("");//$NON-NLS-1$
                                                                                                            int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*',
                                                                                                                        params, f.substring(i, f.length()), 
                                                                                                                        f.substring(i, f.length()), 1);
                                                                                                            if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                            isFramedBox = true;
                                                                                                      }
                                                                                                      else
                                                                                                      {
                                                                                                            i=i2;
                                                                                                            throw new UnknownCommandException(nLine);
                                                                                                      }
                                                                                                }
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnexceptedEndOfFileException();
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'c' : // psccurve
                                                                                          if(i+10>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='c' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && 
                                                                                                f.charAt(++i)=='v' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                      throw new NotYetManagedException("psccurve", nLine);//$NON-NLS-1$
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                          
                                                                                    case 'u' : // pscu
                                                                                          if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          
                                                                                          switch(f.charAt(++i))
                                                                                          {
                                                                                                case 's'://pscus
                                                                                                      if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                      if(f.charAt(++i)=='t' && f.charAt(++i)=='o' && f.charAt(++i)=='m' && 
                                                                                                            (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                                                            f.charAt(i)>'Z'))//pscustom
                                                                                                      {
                                                                                                            int end = texParserActions.parsePsCustomCommand(
                                                                                                                        nLine, f.charAt(i)=='*', params, 
                                                                                                                        f.substring((f.charAt(i)=='*'?i+1:i), f.length()));
                                                                                                            if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                            
                                                                                                      }
                                                                                                      else
                                                                                                      {
                                                                                                            i=i2;
                                                                                                            throw new UnknownCommandException(nLine);
                                                                                                      }
                                                                                                      break;
                                                                                                      
                                                                                                case 'r'://pscur
                                                                                                      if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                      if(f.charAt(++i)=='v' &&f.charAt(++i)=='e' &&
                                                                                                            (f.charAt(++i)<'a' || f.charAt(i)>'z') &&
                                                                                                            (f.charAt(i)<'A' || f.charAt(i)>'Z'))// pscurve
                                                                                                            throw new NotYetManagedException("pscurve", nLine);//$NON-NLS-1$
                                                                                                      
                                                                                                      i=i2;
                                                                                                      throw new UnknownCommandException(nLine);
                                                                                                      
                                                                                                default:
                                                                                                      i=i2;
                                                                                                      throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'a' : // psa
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+1>=lgth)throw new UnexceptedEndOfFileException();
                                                                              i++;
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'x' :// psaxes
                                                                                          if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='e' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {
                                                                                                if(f.charAt(i)=='*')
                                                                                                      i++;
                                                                                                int end = texParserActions.actionsOnGridAxes(nLine, params, 
                                                                                                            PSTricksParameters.pictureSWPt, PSTricksParameters.pictureNEPt, 
                                                                                                            f.substring(i, f.length()), false);
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'd' : // psaddtolength
                                                                                          if(i+10>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='d' && f.charAt(++i)=='t' && f.charAt(++i)=='o' && 
                                                                                                f.charAt(++i)=='l' && f.charAt(++i)=='e' && f.charAt(++i)=='n' &&
                                                                                                f.charAt(++i)=='g' && f.charAt(++i)=='t' && f.charAt(++i)=='t' &&
                                                                                                (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                                                f.charAt(i)>'Z'))
                                                                                                      throw new NotYetManagedException("psaddtolength", nLine);//$NON-NLS-1$
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                          
                                                                                    case 'r' : // psar
                                                                                          if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='c')
                                                                                          {
                                                                                                if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                if((f.charAt(++i)<'a' || f.charAt(i)>'z') &&
                                                                                                            (f.charAt(i)<'A' || f.charAt(i)>'Z'))//psarc
                                                                                                {
                                                                                                      int end = texParserActions.actionsOnArcWedge(nLine, 
                                                                                                                  f.charAt(i)=='*', params, f.substring(i, f.length()),true);
                                                                                                      if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                      if(f.charAt(i)=='n' && (f.charAt(++i)<'a' || f.charAt(i)>'z') &&
                                                                                                            (f.charAt(i)<'A' || f.charAt(i)>'Z'))// psarcn
                                                                                                            throw new NotYetManagedException("psarcn", nLine);//$NON-NLS-1$
                                                                                                }
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                    
                                                                                    default :
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'p' : // psp
                                                                              if(i+1>=lgth)
                                                                              {
                                                                                    if(started) throw new UnexceptedEndOfFileException();
                                                                                    throw new IgnoreCommandException(nLine);
                                                                              }
                                                                              i++;
                                                                              
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'o' :// pspolygon
                                                                                          if(!started)  throw new IgnoreCommandException(nLine);
                                                                                          if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='l' && f.charAt(++i)=='y' && f.charAt(++i)=='g' && 
                                                                                                f.charAt(++i)=='o' && f.charAt(++i)=='n' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {
                                                                                                int end = texParserActions.actionsOnPolygon(nLine, f.charAt(i)=='*', 
                                                                                                            params, f.substring(i, f.length()));
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                                
                                                                                    case 'i' : // pspicture
                                                                                          if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='c' && f.charAt(++i)=='t' && f.charAt(++i)=='u' && 
                                                                                                f.charAt(++i)=='r' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {
                                                                                                if(started)
                                                                                                      throw new FatalErrorParsingException(
                                                                                                      LaTeXDrawLang.getString1_6("PSTricksParser.1")+ //$NON-NLS-1$
                                                                                                      LaTeXDrawLang.getString1_6("PSTricksParser.2")); //$NON-NLS-1$
                                                                                                started = true;
                                                                                                startedWithBeginPs = false;
                                                                                                Point2D.Double pt1, pt2;
                                                                                                String sub = f.substring(i);
                                                                                                try 
                                                                                                {
                                                                                                      pt1 = PSTricksParserActionsManager.readOneCoordinate(sub, 0, nLine, true);
                                                                                                      i += sub.indexOf(")", 0);//$NON-NLS-1$
                                                                                                }catch(Exception e)
                                                                                                { 
                                                                                                      throw new FatalErrorParsingException("Invalid command \\begin{pspicture}");//$NON-NLS-1$
                                                                                                }
                                                                                                
                                                                                                int j, k = ++i;
                                                                                                try 
                                                                                                { // optional
                                                                                                      while(k<lgth && (PSTricksParserActionsManager.isCharToIgnore(f.charAt(k)) ||
                                                                                                                  f.charAt(k)=='\\'))
                                                                                                            k++;
                                                                                                
                                                                                                      if(f.charAt(k)!='(') throw new IgnoreCommandException(-1);
                                                                                                      j = f.indexOf(')', k);
                                                                                                      sub = f.substring(k, j+1);
                                                                                                      pt2 = PSTricksParserActionsManager.readOneCoordinate(sub, 0, nLine, true);
                                                                                                      i = j;
                                                                                                }catch(IgnoreCommandException e)
                                                                                                {
                                                                                                      pt2 = pt1;
                                                                                                      pt1 = new Point2D.Double(0,0);
                                                                                                }
                                                                                                catch(Exception e)
                                                                                                {
                                                                                                      throw new FatalErrorParsingException("Invalid command \\begin{pspicture}");//$NON-NLS-1$
                                                                                                }
                                                                                                
                                                                                                PSTricksParameters.pictureNEPt = pt2;
                                                                                                PSTricksParameters.pictureSWPt = pt1;
                                                                                                params.add(new PSTricksParameters());
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'a' : // psparabola
                                                                                          if(!started)  throw new IgnoreCommandException(nLine);
                                                                                          if(i+7>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='r' && f.charAt(++i)=='a' && f.charAt(++i)=='b' && 
                                                                                                f.charAt(++i)=='o' && f.charAt(++i)=='l' && f.charAt(++i)=='a' &&
                                                                                                (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                                                f.charAt(i)>'Z'))
                                                                                                      throw new NotYetManagedException("psparabola", nLine);//$NON-NLS-1$
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    
                                                                                    default :
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 's' : // pss
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+1>=lgth)throw new UnexceptedEndOfFileException();
                                                                              i++;
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'e' :// psset
                                                                                          if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='t')
                                                                                          {
                                                                                                if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                if((f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                                      (f.charAt(i)<'A' || f.charAt(i)>'Z'))//psset
                                                                                                {
                                                                                                      int j = i;
                                                                                                      int cptBrack=0;
                                                                                                      
                                                                                                      while(j<lgth && f.charAt(j)!='{')
                                                                                                            j++;
                                                                                                      j++;
                                                                                                      
                                                                                                      while(j<lgth && (f.charAt(j)!='}' || cptBrack>0))
                                                                                                      {
                                                                                                            if(f.charAt(j)=='{') 
                                                                                                                  cptBrack++;
                                                                                                            else if(f.charAt(j)=='}' && cptBrack>0)
                                                                                                                  cptBrack--;
                                                                                                            j++; // We search the '}'
                                                                                                      }
                                                                                                      if(j>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                      j++;
                                                                                                      String str = f.substring(i, j);
                                                                                                      PSTricksParserActionsManager.parsepssetCommand(str, params.lastElement());
                                                                                                      i = j;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                      if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                      if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && 
                                                                                                            (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                                                            f.charAt(i)>'Z'))//pssetbox
                                                                                                                  throw new NotYetManagedException("pssetbox", nLine);//$NON-NLS-1$
                                                                                                }
                                                                                          } // if(f.charAt(++i)=='t')
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                  
                                                                                    case 'h' : // psshadowbox
                                                                                          if(i+8>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='a' && f.charAt(++i)=='d' && f.charAt(++i)=='o' && 
                                                                                                f.charAt(++i)=='w' && f.charAt(++i)=='b' && f.charAt(++i)=='o' && 
                                                                                                f.charAt(++i)=='x' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {
                                                                                                PSTricksParameters tp = params.lastElement();
                                                                                                
                                                                                                if(tp.psBox.isEmpty())
                                                                                                      tp.psBoxText.setText("");//$NON-NLS-1$
                                                                                                int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*',
                                                                                                            params, f.substring(i, f.length()), 
                                                                                                            f.substring(i, f.length()), 6);
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                isFramedBox = true;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    default :
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'f' : // psf
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='r' && f.charAt(++i)=='a' && f.charAt(++i)=='m' &&
                                                                                    f.charAt(++i)=='e')//psframe
                                                                              {
                                                                                    if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                    i++;
                                                                                    if((f.charAt(i)<'a' || f.charAt(i)>'z') && 
                                                                                          (f.charAt(i)<'A' || f.charAt(i)>'Z'))//psframe
                                                                                    {
                                                                                          int end = texParserActions.actionsOnFrameEllipse(nLine, 
                                                                                                      f.charAt(i)=='*', params, f.substring(i, f.length()), true);
                                                                                          if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' && 
                                                                                                (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' ||
                                                                                                f.charAt(i)>'Z'))//psframebox
                                                                                          {
                                                                                                PSTricksParameters tp = params.lastElement();
                                                                                                
                                                                                                if(tp.psBox.isEmpty())
                                                                                                      tp.psBoxText.setText("");//$NON-NLS-1$
                                                                                                int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*',
                                                                                                            params, f.substring(i, f.length()), 
                                                                                                            f.substring(i, f.length()), 0);
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) 
                                                                                                {
                                                                                                      i+=end;
                                                                                                      isFramedBox = true;
                                                                                                }
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                    }
                                                                              }
                                                                              else
                                                                              {
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'l' : // psl
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                              i++;
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'i' :// psline
                                                                                          if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='n' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {
                                                                                                int end = texParserActions.actionsOnLine(nLine, f.charAt(i)=='*', 
                                                                                                            params, f.substring(i, f.length()));
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'o' : // pslongbox
                                                                                          if(i+10>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='n' && f.charAt(++i)=='g' && f.charAt(++i)=='b' && 
                                                                                                f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                      throw new NotYetManagedException("pslongbox", nLine);//$NON-NLS-1$
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    
                                                                                    default :
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'd' : //psd
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                              i++;
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'o' :// psdots
                                                                                          if(++i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          
                                                                                          if(f.charAt(i)=='t') // psdot
                                                                                          {
                                                                                                if(++i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                if((f.charAt(i)<'a' || f.charAt(i)>'z') && 
                                                                                                   (f.charAt(i)<'A' || f.charAt(i)>'Z')) //psdot command
                                                                                             {
                                                                                                      int end = texParserActions.actionsOnDot(nLine, params, f.substring(i, f.length()),true);
                                                                                                      if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                             }else
                                                                                             {
                                                                                                   if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                   if(f.charAt(i)=='s' && (f.charAt(++i)<'a' || 
                                                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                      { // psdots
                                                                                                            int end = texParserActions.actionsOnDot(nLine, params, f.substring(i, f.length()),false);
                                                                                                            if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                      }else
                                                                                                      {
                                                                                                            i=i2;
                                                                                                            throw new UnknownCommandException(nLine);
                                                                                                      }
                                                                                             }
                                                                                          }else 
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'b' : // psdblframebox
                                                                                          if(i+10>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='l' && f.charAt(++i)=='f' && f.charAt(++i)=='r' &&
                                                                                                f.charAt(++i)=='a' && f.charAt(++i)=='m' && f.charAt(++i)=='e' &&
                                                                                                f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' &&
                                                                                                (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {
                                                                                                PSTricksParameters tp = params.lastElement();
                                                                                                
                                                                                                if(tp.psBox.isEmpty())
                                                                                                      tp.psBoxText.setText("");//$NON-NLS-1$
                                                                                                int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*',
                                                                                                            params, f.substring(i, f.length()), 
                                                                                                            f.substring(i, f.length()), 5);
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                isFramedBox = true;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                    break;
                                                                                          
                                                                                    case 'i' : // psdi
                                                                                          if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          
                                                                                          if(f.charAt(++i)=='a')//psdia
                                                                                          {
                                                                                                if(i+5>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                if(f.charAt(++i)=='m' && f.charAt(++i)=='o' &&
                                                                                                   f.charAt(++i)=='n' && f.charAt(++i)=='d' && (f.charAt(++i)<'a' || 
                                                                                                   f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                {// psdiamond
                                                                                                      int end = texParserActions.actionsOnDiamondTriangle(nLine, 
                                                                                                                  f.charAt(i)=='*', params, f.substring(i, f.length()), true);
                                                                                                      if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                      if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                      if(f.charAt(i)=='b' && f.charAt(++i)=='o' &&
                                                                                                         f.charAt(++i)=='x' && (f.charAt(++i)<'a' || 
                                                                                                         f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                      {//psdiabox
                                                                                                            PSTricksParameters tp = params.lastElement();
                                                                                                            
                                                                                                            if(tp.psBox.isEmpty())
                                                                                                                  tp.psBoxText.setText("");//$NON-NLS-1$
                                                                                                            int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*',
                                                                                                                        params, f.substring(i, f.length()), 
                                                                                                                        f.substring(i, f.length()), 3);
                                                                                                            if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                            isFramedBox = true;
                                                                                                      }
                                                                                                      else
                                                                                                      {
                                                                                                            i=i2;
                                                                                                            throw new UnknownCommandException(nLine);
                                                                                                      }
                                                                                                }
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    default :
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'e' : // pse
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                              i++;
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'l' :// psellipse
                                                                                          if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='l' && f.charAt(++i)=='i' && f.charAt(++i)=='p' &&
                                                                                                f.charAt(++i)=='s' && f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {
                                                                                                int end = texParserActions.actionsOnFrameEllipse(nLine, f.charAt(i)=='*', 
                                                                                                            params, f.substring(i, f.length()), false);
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'c' : // psecurve
                                                                                          if(i+5>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='v' &&
                                                                                                f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                                f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                      throw new NotYetManagedException("psecurve", nLine);//$NON-NLS-1$
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    
                                                                                    default :
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 't' : // pst
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+2>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='r' && f.charAt(++i)=='i')
                                                                              {//pstri
                                                                                    if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                                    if(f.charAt(++i)=='a' && f.charAt(++i)=='n' && f.charAt(++i)=='g' && 
                                                                                          f.charAt(++i)=='l' && f.charAt(++i)=='e' &&
                                                                                          (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    {//pstriangle
                                                                                          int end = texParserActions.actionsOnDiamondTriangle(nLine, f.charAt(i)=='*', 
                                                                                                                                    params, f.substring(i, f.length()), false);
                                                                                          if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' &&
                                                                                                (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {//pstribox
                                                                                                PSTricksParameters tp = params.lastElement();
                                                                                                
                                                                                                if(tp.psBox.isEmpty())
                                                                                                      tp.psBoxText.setText("");//$NON-NLS-1$
                                                                                                int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*',
                                                                                                            params, f.substring(i, f.length()), 
                                                                                                            f.substring(i, f.length()), 2);
                                                                                                if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                                isFramedBox = true;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                    }
                                                                              }
                                                                              else
                                                                              {
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'C' ://psCoil
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='o' && f.charAt(++i)=='i' && f.charAt(++i)=='l' &&
                                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          throw new NotYetManagedException("psCoil", nLine);//$NON-NLS-1$
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                              
                                                                        case 'b' : // psbezier
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='e' && f.charAt(++i)=='z' && f.charAt(++i)=='i' &&
                                                                                    f.charAt(++i)=='e' && f.charAt(++i)=='r' && (f.charAt(++i)<'a' || 
                                                                                    f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                              {
                                                                                    int end = texParserActions.actionsOnBezierCurve(nLine, f.charAt(i)=='*', 
                                                                                                params, f.substring(i, f.length()));
                                                                                    if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                              }
                                                                              else
                                                                              {
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'w' : // pswedge
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+5>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='e' && f.charAt(++i)=='d' && f.charAt(++i)=='g' &&
                                                                                    f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                    f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                              {
                                                                                    int end = texParserActions.actionsOnArcWedge(nLine, f.charAt(i)=='*', 
                                                                                                params, f.substring(i, f.length()),false);
                                                                                    if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                              }
                                                                              else
                                                                              {
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'g' : // psgrid
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='r' && f.charAt(++i)=='i' && f.charAt(++i)=='d' &&
                                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                              {
                                                                                    int end = texParserActions.actionsOnGridAxes(nLine, params, 
                                                                                                PSTricksParameters.pictureSWPt, PSTricksParameters.pictureNEPt, 
                                                                                                f.substring(i, f.length()), true);
                                                                                    if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                              }
                                                                              else
                                                                              {
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'o' : // psovalbox
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+7>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='v' && f.charAt(++i)=='a' && f.charAt(++i)=='l' &&
                                                                                    f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' &&
                                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' ||
                                                                                    f.charAt(i)>'Z'))
                                                                              {
                                                                                    PSTricksParameters tp = params.lastElement();
                                                                                    
                                                                                    if(tp.psBox.isEmpty())
                                                                                          tp.psBoxText.setText("");//$NON-NLS-1$
                                                                                    int end = texParserActions.actionsOnFramedBox(nLine, f.charAt(i)=='*',
                                                                                                params, f.substring(i, f.length()), 
                                                                                                f.substring(i, f.length()), 4);
                                                                                    if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                                    isFramedBox = true;
                                                                              }
                                                                              else
                                                                              {
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'z' : // pszigzag
                                                                              if(!started)  throw new IgnoreCommandException(nLine);
                                                                              if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='z' &&
                                                                                    f.charAt(++i)=='a' && f.charAt(++i)=='g' && (f.charAt(++i)<'a' || 
                                                                                    f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          throw new NotYetManagedException("pszigzag", nLine);//$NON-NLS-1$
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                              
                                                                        default :
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                  } // switch(f.charAt(i))
                                                                  break;
                                                                  
                                                            case 'u':// pu
                                                                  if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                  if(f.charAt(++i)=='t' && //put
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        int j = i;
                                                                        
                                                                        while(j<lgth && f.charAt(j)!='{') // We extract the command the string : put(...){...}
                                                                              j++; 
                                                                        
                                                                        if(++j>=lgth) throw new UnexceptedEndOfFileException();
                                                                        
                                                                        String putS = f.substring(i, j);
                                                                        try{PSTricksParserActionsManager.parseputCommand(putS, params);}
                                                                        catch(Exception e){ e.printStackTrace(); throw new InvalidFormatCommandException("put", nLine); }//$NON-NLS-1$
                                                                        i = j;
                                                                  }
                                                                  else
                                                                  {
                                                                        i=i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  
                                                                  break;
                                                                  
                                                            case 'o' : //polar
                                                                  if(i+4>=lgth)throw new UnexceptedEndOfFileException();
                                                                  if(f.charAt(++i)=='l' && f.charAt(++i)=='a' && f.charAt(++i)=='r' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' ||
                                                                        f.charAt(i)>'Z'))
                                                                        throw new WillNeverBeManagedException("polar", nLine);//$NON-NLS-1$
                                                            break;
                                                            
                                                            default :
                                                                  i=i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      } // switch(f.charAt(i))
                                                      break;
                                                      
                                                      
                                                case 'n' :
                                                      i2 = i;
                                                      if(i+1>=lgth)
                                                      {
                                                            if(!started) throw new IgnoreCommandException(nLine);
                                                            throw new UnexceptedEndOfFileException();
                                                      }
                                                      i++;
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 'e' ://ne
                                                                  if(i+1>=lgth)
                                                                  {
                                                                        i=i2;
                                                                        if(!started) throw new IgnoreCommandException(nLine);
                                                                        throw new UnexceptedEndOfFileException();
                                                                  }
                                                                  i++;
                                                                  if(f.charAt(i)=='w')//new
                                                                  {
                                                                        if(i+1>=lgth)
                                                                        {
                                                                              i=i2;
                                                                              if(!started) throw new IgnoreCommandException(nLine);
                                                                              throw new UnexceptedEndOfFileException();
                                                                        }
                                                                        i++;
                                                                        
                                                                        switch(f.charAt(i))
                                                                        {
                                                                              case 'p' : //newp
                                                                                    if(i+1>=lgth)
                                                                                    {
                                                                                          i=i2;
                                                                                          if(!started) throw new IgnoreCommandException(nLine);
                                                                                          throw new UnexceptedEndOfFileException();
                                                                                    }
                                                                                    i++;
                                                                                    switch(f.charAt(i))
                                                                                    {
                                                                                          case 's'://newps
                                                                                                if(i+1>=lgth)
                                                                                                {
                                                                                                      i=i2;
                                                                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                                                                      throw new UnexceptedEndOfFileException();
                                                                                                }
                                                                                                i++;
                                                                                                switch(f.charAt(i))
                                                                                                {
                                                                                                      case 's' ://newpsstyle
                                                                                                            if(i+5>=lgth)
                                                                                                            {
                                                                                                                  if(!started) throw new IgnoreCommandException(nLine);
                                                                                                                  throw new UnexceptedEndOfFileException();
                                                                                                            }
                                                                                                            if(f.charAt(++i)=='t' && f.charAt(++i)=='y' && f.charAt(++i)=='l' &&
                                                                                                                  f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                                                  f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                                  throw new NotYetManagedException("newpsstyle", nLine);//$NON-NLS-1$
                                                                                                            i=i2;
                                                                                                            if(started) throw new UnknownCommandException(nLine);
                                                                                                            throw new IgnoreCommandException(nLine);
                                                                                                      
                                                                                                      case 'o' : //newpsobject
                                                                                                            if(i+1>=lgth)
                                                                                                            {
                                                                                                                  if(!started) throw new IgnoreCommandException(nLine);
                                                                                                                  throw new UnexceptedEndOfFileException();
                                                                                                            }
                                                                                                            i++;
                                                                                                            if(f.charAt(++i)=='b' && f.charAt(++i)=='j' && f.charAt(++i)=='e' &&
                                                                                                                  f.charAt(++i)=='c' && f.charAt(++i)=='t' &&     (f.charAt(++i)<'a' || 
                                                                                                                  f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                                  throw new NotYetManagedException("newpsobject", nLine);//$NON-NLS-1$
                                                                                                            i=i2;
                                                                                                            if(started) throw new UnknownCommandException(nLine);
                                                                                                            throw new IgnoreCommandException(nLine);
                                                                                                      
                                                                                                      default :
                                                                                                            i=i2;
                                                                                                            if(started) throw new UnknownCommandException(nLine);
                                                                                                            throw new IgnoreCommandException(nLine);
                                                                                                } // switch(f.charAt(i))
                                                                                    
                                                                                          case 'a'://newpa
                                                                                                if(!started) throw new IgnoreCommandException(nLine);
                                                                                                if(i+3>=lgth)
                                                                                                      throw new UnexceptedEndOfFileException();
                                                                                                
                                                                                                if(f.charAt(++i)=='t' && f.charAt(++i)=='h'&& (f.charAt(++i)<'a' || 
                                                                                                      f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                {//newpath
                                                                                                      texParserActions.actionsOnNewPath(nLine);
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                      i=i2;
                                                                                                      throw new UnknownCommandException(nLine);
                                                                                                }
                                                                                                break;
                                                                                                
                                                                                          default:
                                                                                                i=i2;
                                                                                                if(started) throw new UnknownCommandException(nLine);
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                    }
                                                                                    break;
                                                                                    
                                                                              case 'c':// newcmykcolor
                                                                                    if(i + 8 >= lgth)
                                                                                    {
                                                                                          if(!started)
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                          throw new UnexceptedEndOfFileException();
                                                                                    }
                                                                                    
                                                                                    if(f.charAt(++i) == 'm' && f.charAt(++i) == 'y' && f.charAt(++i) == 'k' && 
                                                                                          f.charAt(++i) == 'c' && f.charAt(++i) == 'o' && f.charAt(++i) == 'l' && 
                                                                                          f.charAt(++i) == 'o' && f.charAt(++i) == 'r' && (f.charAt(++i) < 'a' || 
                                                                                                      f.charAt(i) > 'z') && (f.charAt(i) < 'A' || f.charAt(i) > 'Z'))
                                                                                    {
                                                                                          int j = i, cptBracket = 0;

                                                                                          while(cptBracket < 2 && j < f.length())
                                                                                          {
                                                                                                if(f.charAt(j) == '}')
                                                                                                      cptBracket++;
                                                                                                j++;
                                                                                          }

                                                                                          if(cptBracket < 2)
                                                                                                throw new InvalidFormatCommandException("newcmykcolor", nLine);//$NON-NLS-1$
                                                                                          
                                                                                          String p = f.substring(i, j);
                                                                                          
                                                                                          try { PSTricksParserActionsManager.parseNewcmykcolorParameters(p); }
                                                                                          catch(Exception e)
                                                                                          {
                                                                                                e.printStackTrace();
                                                                                                throw new InvalidFormatCommandException("newcmykcolor", nLine);//$NON-NLS-1$
                                                                                          }
                                                                                          
                                                                                          i = j;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          i = i2;
                                                                                          if(started)
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          throw new IgnoreCommandException(nLine);
                                                                                    }
                                                                                    break; 
                                                                              
                                                                              case 'h':// newhsbcolor
                                                                                    if(i + 8 >= lgth)
                                                                                    {
                                                                                          if(!started)
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                          throw new UnexceptedEndOfFileException();
                                                                                    }
                                                                                    
                                                                                    if(f.charAt(++i) == 's' && f.charAt(++i) == 'b' && f.charAt(++i) == 'c' && 
                                                                                          f.charAt(++i) == 'o' && f.charAt(++i) == 'l' && f.charAt(++i) == 'o' && 
                                                                                          f.charAt(++i) == 'r' && (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && 
                                                                                          (f.charAt(i) < 'A' || f.charAt(i) > 'Z'))
                                                                                    {
                                                                                          int j = i, cptBracket = 0;

                                                                                          while(cptBracket < 2 && j < f.length())
                                                                                          {
                                                                                                if(f.charAt(j) == '}')
                                                                                                      cptBracket++;
                                                                                                j++;
                                                                                          }

                                                                                          if(cptBracket < 2)
                                                                                                throw new InvalidFormatCommandException("newhsbcolor", nLine);//$NON-NLS-1$
                                                                                          
                                                                                          String p = f.substring(i, j);
                                                                                          
                                                                                          try { PSTricksParserActionsManager.parseNewhsbcolorParameters(p); }
                                                                                          catch(Exception e)
                                                                                          {
                                                                                                e.printStackTrace();
                                                                                                throw new InvalidFormatCommandException("newhsbcolor", nLine);//$NON-NLS-1$
                                                                                          }
                                                                                          
                                                                                          i = j;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          i = i2;
                                                                                          if(started)
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          throw new IgnoreCommandException(nLine);
                                                                                    }
                                                                                    break; 
                                                                                    
                                                                                case 'r':// newrgbcolor
                                                                                          if(i + 8 >= lgth)
                                                                                          {
                                                                                                if(!started)
                                                                                                      throw new IgnoreCommandException(nLine);
                                                                                                throw new UnexceptedEndOfFileException();
                                                                                          }
                                                                                          
                                                                                          if(f.charAt(++i) == 'g' && f.charAt(++i) == 'b' && f.charAt(++i) == 'c' && 
                                                                                                f.charAt(++i) == 'o' && f.charAt(++i) == 'l' && f.charAt(++i) == 'o' && 
                                                                                                f.charAt(++i) == 'r' && (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && 
                                                                                                (f.charAt(i) < 'A' || f.charAt(i) > 'Z'))
                                                                                          {
                                                                                                int j = i, cptBracket = 0;

                                                                                                while(cptBracket < 2 && j < f.length())
                                                                                                {
                                                                                                      if(f.charAt(j) == '}')
                                                                                                            cptBracket++;
                                                                                                      j++;
                                                                                                }

                                                                                                if(cptBracket < 2)
                                                                                                      throw new InvalidFormatCommandException("newrgbcolor", nLine);//$NON-NLS-1$
                                                                                                
                                                                                                String p = f.substring(i, j);
                                                                                                
                                                                                                try { PSTricksParserActionsManager.parseNewrgbcolorParameters(p); }
                                                                                                catch(Exception e)
                                                                                                {
                                                                                                      e.printStackTrace();
                                                                                                      throw new InvalidFormatCommandException("newrgbcolor", nLine);//$NON-NLS-1$
                                                                                                }
                                                                                                
                                                                                                i = j;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i = i2;
                                                                                                if(started)
                                                                                                      throw new UnknownCommandException(nLine);
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                          }
                                                                                          break; 
                                                                                    
                                                                                case 'g':// newgray
                                                                                          if(i + 4 >= lgth)
                                                                                          {
                                                                                                if(!started)
                                                                                                      throw new IgnoreCommandException(nLine);
                                                                                                throw new UnexceptedEndOfFileException();
                                                                                          }
                                                                                          
                                                                                          if(f.charAt(++i) == 'r' && f.charAt(++i) == 'a' && f.charAt(++i) == 'y' && 
                                                                                                (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && (f.charAt(i) < 'A' || 
                                                                                                f.charAt(i) > 'Z'))
                                                                                          {
                                                                                                int j = i, cptBracket = 0;

                                                                                                while(cptBracket < 2 && j < f.length())
                                                                                                {
                                                                                                      if(f.charAt(j) == '}')
                                                                                                            cptBracket++;
                                                                                                      j++;
                                                                                                }

                                                                                                if(cptBracket < 2)
                                                                                                      throw new InvalidFormatCommandException("newgray", nLine);//$NON-NLS-1$
                                                                                                
                                                                                                String p = f.substring(i, j);
                                                                                                
                                                                                                try { PSTricksParserActionsManager.parseNewgrayParameters(p); }
                                                                                                catch(Exception e)
                                                                                                {
                                                                                                      e.printStackTrace();
                                                                                                      throw new InvalidFormatCommandException("newgray", nLine);//$NON-NLS-1$
                                                                                                }
                                                                                                
                                                                                                i = j;
                                                                                          }
                                                                                          else
                                                                                          {
                                                                                                i = i2;
                                                                                                if(started)
                                                                                                      throw new UnknownCommandException(nLine);
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                        
                                                                              default :
                                                                                    i=i2;
                                                                                    if(started) throw new UnknownCommandException(nLine);
                                                                                    throw new IgnoreCommandException(nLine);
                                                                        } // switch(f.charAt(i))
                                                                  }// if(f.charAt(i)=='w')
                                                                  else
                                                                  {
                                                                        i=i2;
                                                                        if(started) throw new UnknownCommandException(nLine);
                                                                        throw new IgnoreCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'o' :// no
                                                                  if(!started)   throw new IgnoreCommandException(nLine);
                                                                  if(i+9>=lgth) throw new UnexceptedEndOfFileException();

                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if(f.charAt(++i)=='r' && f.charAt(++i)=='m' && f.charAt(++i)=='a' && f.charAt(++i)=='l')
                                                                  {// normal
                                                                        if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                        ++i;
                                                                        
                                                                        switch(f.charAt(i))
                                                                        {
                                                                              case 'c': // normalcolor
                                                                                    if(i+5>=lgth) throw new UnexceptedEndOfFileException();
                                                                                    
                                                                                    if(f.charAt(++i)=='o' && f.charAt(++i)=='l' && f.charAt(++i)=='o' && 
                                                                                          f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                          (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                tp.textColor = Color.BLACK;
                                                                                          else
                                                                                          {
                                                                                                i=i2;
                                                                                                throw new UnknownCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                    
                                                                              case 's':// normalsize
                                                                                    if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                                    
                                                                                    if(f.charAt(++i)=='i' && f.charAt(++i)=='z' && 
                                                                                          f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                          (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                                tp.textSize = PSTricksConstants.COMMAND_TEXT_NORMAL;
                                                                                    else
                                                                                    {
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    }
                                                                                    break;
                                                                                    
                                                                              default :
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                        }
                                                                  }
                                                                  else
                                                                  {
                                                                        i=i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i=i2;
                                                                  if(started) throw new UnknownCommandException(nLine);
                                                                  throw new IgnoreCommandException(nLine);
                                                      }
                                                      break;
                                                
                                                      
                                                case 'r' : 
                                                      i2 = i;
                                                      i++;
                                                      if(!started) { i=i2; throw new IgnoreCommandException(nLine); }
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 'o' : //ro
                                                                  if(i+4>=lgth)throw new UnexceptedEndOfFileException();
                                                                  
                                                                  if(f.charAt(++i)=='t' && f.charAt(++i)=='a' && f.charAt(++i)=='t' &&
                                                                        f.charAt(++i)=='e')//rotate
                                                                  {
                                                                        i++;
                                                                        if(i>=lgth)throw new UnexceptedEndOfFileException();
                                                                        switch(f.charAt(i))
                                                                        {
                                                                              case 'b' : //rotatebox
                                                                                    if(i+3>=lgth)throw new UnexceptedEndOfFileException();
                                                                                    if(f.charAt(++i)=='o' && f.charAt(++i)=='x' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                      (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    {
                                                                                          int nb=0, j = i;
                                                                                          
                                                                                          while(j < lgth && nb<2)
                                                                                          {
                                                                                                if(f.charAt(j)=='{')
                                                                                                      nb++;
                                                                                                j++;
                                                                                          }

                                                                                          if(j >= lgth)
                                                                                          {
                                                                                                j = i2;
                                                                                                throw new InvalidFormatCommandException("rotatebox", nLine);//$NON-NLS-1$
                                                                                          }
                                                                                          
                                                                                          PSTricksParserActionsManager.parseRotateBoxCommand(f.substring(i, j), params);

                                                                                          i = j+1;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          i=i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    }
                                                                                    break;
                                                                                    
                                                                              case 'l': // rotateleft
                                                                                    if(i + 4 >= lgth)
                                                                                          throw new UnexceptedEndOfFileException();
                                                                                    if(f.charAt(++i) == 'e' && f.charAt(++i) == 'f' && f.charAt(++i) == 't' && 
                                                                                          (f.charAt(++i) < 'a' || f.charAt(i) > 'z') && (f.charAt(i) < 'A' || f.charAt(i) > 'Z'))
                                                                                    {
                                                                                          params.add(new PSTricksParameters(params.lastElement()));

                                                                                          while(i < lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                i++;

                                                                                          if(i >= lgth || f.charAt(i) != '{')
                                                                                          {
                                                                                                i = i2;
                                                                                                throw new InvalidFormatCommandException("rotateleft", nLine);//$NON-NLS-1$
                                                                                          }

                                                                                          i++;
                                                                                          params.lastElement().setPosition(0, 0, true, 90, 0, 0, 0., 0.);
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          i = i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    }
                                                                                    break; 
                                                                              
                                                                              case 'r' : // rotateright
                                                                                    if(i+5>=lgth)throw new UnexceptedEndOfFileException();
                                                                                    if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='h' && f.charAt(++i)=='t' &&
                                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    {
                                                                                          params.add(new PSTricksParameters(params.lastElement()));

                                                                                          while(i < lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                i++;

                                                                                          if(i >= lgth || f.charAt(i) != '{')
                                                                                          {
                                                                                                i = i2;
                                                                                                throw new InvalidFormatCommandException("rotateright", nLine);//$NON-NLS-1$
                                                                                          }

                                                                                          i++;
                                                                                          params.lastElement().setPosition(0, 0, true, -90, 0, 0, 0., 0.);
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          i = i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    }
                                                                                    break;      
                                                                                          
                                                                              case 'd' : // rotatedown
                                                                                    if(i+4>=lgth)throw new UnexceptedEndOfFileException();
                                                                                    if(f.charAt(++i)=='o' && f.charAt(++i)=='w' && f.charAt(++i)=='n' &&
                                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    {
                                                                                          params.add(new PSTricksParameters(params.lastElement()));

                                                                                          while(i < lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                i++;

                                                                                          if(i >= lgth || f.charAt(i) != '{')
                                                                                          {
                                                                                                i = i2;
                                                                                                throw new InvalidFormatCommandException("rotatedown", nLine);//$NON-NLS-1$
                                                                                          }

                                                                                          i++;
                                                                                          params.lastElement().setPosition(0, 0, true, 180, 0, 0, 0., 0.);
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                          i = i2;
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    }
                                                                                    break;      
                                                                              
                                                                              default :
                                                                                    i=i2;
                                                                                    throw new UnknownCommandException(nLine); 
                                                                        } // switch(f.charAt(i))
                                                                  } // if(f.charAt(++i)=='t' && f.
                                                                  else
                                                                  {
                                                                        i=i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                            
                                                            case 'e' : // re
                                                                  i++;
                                                                  if(i>=lgth)
                                                                  {
                                                                        i=i2;
                                                                        throw new IgnoreCommandException(nLine);
                                                                  }
                                                                  
                                                                  switch(f.charAt(i))
                                                                  {
                                                                        case 'd' : // red
                                                                              if(i+1>=lgth) throw new UnexceptedEndOfFileException();

                                                                              PSTricksParameters tp = params.lastElement();
                                                                              if((f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                    (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    tp.textColor = Color.RED;
                                                                              else
                                                                              {
                                                                                    i=i2;
                                                                                    throw new IgnoreCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 's' : // resizebox
                                                                              if(i+7>=lgth)throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='i' && f.charAt(++i)=='z' && f.charAt(++i)=='e' &&
                                                                                    f.charAt(++i)=='b' && f.charAt(++i)=='o' && f.charAt(++i)=='x' &&
                                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                    (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    throw new NotYetManagedException("resizebox", nLine);//$NON-NLS-1$
                                                                              
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                              
                                                                        default :
                                                                              i=i2;
                                                                              throw new IgnoreCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            
                                                            case 'a' : // radians
                                                                  if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if(f.charAt(++i)=='d' && f.charAt(++i)=='i' && f.charAt(++i)=='a' &&
                                                                        f.charAt(++i)=='n' && f.charAt(++i)=='s' && (f.charAt(++i)<'a' || 
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        tp.onRadians = true;
                                                                        params.lastElement().degrees=Math.PI*2;
                                                                  }
                                                                  else
                                                                  {
                                                                        i=i2;
                                                                        throw new IgnoreCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'p' : // rput
                                                                  if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                  if(f.charAt(++i)=='u' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || 
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        int j = i;
                                                                        boolean end = false, hasStar = f.charAt(i)=='*';
                                                                        
                                                                        while(j<lgth && ((f.charAt(j)!='{' || !end))) 
                                                                        { // We extract the command the string : rput*{..}(..){...
                                                                              if(f.charAt(j)=='(') end = true;
                                                                              else if(f.charAt(j)=='{') end = true;
                                                                              j++; 
                                                                        }
                                                                        if(++j>=lgth) throw new UnexceptedEndOfFileException();
                                                                        
                                                                        String rputS = f.substring(i, j);
                                                                        try{PSTricksParserActionsManager.parserputCommand(rputS, hasStar, params);}
                                                                        catch(Exception e){ e.printStackTrace(); throw new InvalidFormatCommandException("rput", nLine); }//$NON-NLS-1$
                                                                        i = j;
                                                                  }else
                                                                  {
                                                                        i=i2;
                                                                        throw new IgnoreCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default : 
                                                                  i=i2;
                                                                  throw new IgnoreCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                      
                                                case 's' :
                                                if(!started) throw new IgnoreCommandException(nLine);
                                                i2 = i;     
                                                i++;
                                                if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                
                                                switch(f.charAt(i))
                                                {
                                                      case 'c' : //sc
                                                            if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                            i++;
                                                            switch(f.charAt(i))
                                                            {
                                                                  case 'a' : //sca
                                                                        if(i+5>=lgth) throw new UnexceptedEndOfFileException();
                                                                        if(f.charAt(++i)=='l' && f.charAt(++i)=='e' && f.charAt(++i)=='b' &&
                                                                              f.charAt(++i)=='o' && f.charAt(++i)=='x')
                                                                        {
                                                                              if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if((f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                    (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    throw new NotYetManagedException("scalebox", nLine);//$NON-NLS-1$
                                                                              
                                                                              if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                              if(f.charAt(++i)=='t' && f.charAt(++i)=='o' &&  
                                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                                    (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          throw new NotYetManagedException("scaleboxto", nLine);//$NON-NLS-1$
                                                                        }
                                                                        i=i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  
                                                                  case 'r' : // scriptsize
                                                                        if(i+8>=lgth) throw new UnexceptedEndOfFileException();
                                                                        PSTricksParameters tp = params.lastElement();
                                                                        if(f.charAt(++i)=='i' && f.charAt(++i)=='p' && f.charAt(++i)=='t' &&
                                                                              f.charAt(++i)=='s' && f.charAt(++i)=='i' && f.charAt(++i)=='z' && 
                                                                              f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                              (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                              tp.textSize = PSTricksConstants.COMMAND_TEXT_SCRIPT;
                                                                        else
                                                                        {
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                        }
                                                                        break;
                                                                        
                                                                  default :
                                                                        i=i2;
                                                                        throw new UnknownCommandException(nLine);
                                                            }
                                                            break;
                                                      
                                                      case 'l' : // sl
                                                            if(i+1>=lgth) throw new UnexceptedEndOfFileException();

                                                            PSTricksParameters tp = params.lastElement();
                                                            if((f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                  (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  tp.textItalic = true;
                                                            else
                                                            {
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                            }
                                                            break;
                                                            
                                                      case 'm' : // small
                                                            if(i+4>=lgth) throw new UnexceptedEndOfFileException();

                                                            tp = params.lastElement();
                                                            if(f.charAt(++i)=='a' && f.charAt(++i)=='l' && f.charAt(++i)=='l' &&
                                                                  (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                               f.charAt(i)>'Z'))
                                                                  tp.textSize = PSTricksConstants.COMMAND_TEXT_SMALL;
                                                            else
                                                            {
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                            }
                                                            break;
                                                      
                                                      case 't' : // st
                                                            if(i+2>=lgth) throw new UnexceptedEndOfFileException();
                                                            
                                                            if(f.charAt(++i)=='r') // str
                                                            {
                                                                  i++;
                                                                  if(f.charAt(i)=='o') // stro
                                                                  {
                                                                        if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                        if(f.charAt(++i)=='k' && f.charAt(++i)=='e' && 
                                                                              (f.charAt(++i)<'a' || f.charAt(i)>'z') &&
                                                                              (f.charAt(i)<'A' || f.charAt(i)>'Z')) // stroke
                                                                              throw new NotYetManagedException("stroke", nLine);//$NON-NLS-1$
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  else if(f.charAt(i)=='i') // stri
                                                                  {
                                                                        if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                        if(f.charAt(++i)=='n' && f.charAt(++i)=='g' && 
                                                                              (f.charAt(++i)<'a' || f.charAt(i)>'z') &&
                                                                              (f.charAt(i)<'A' || f.charAt(i)>'Z')) // string
                                                                        {
                                                                              // nothing to do
                                                                        }else
                                                                        {
                                                                              i = i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                        }
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                            }
                                                            else
                                                            {
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                            }
                                                            break;
                                                      
                                                      case 'w' : // swapaxes
                                                            if(i+7>=lgth) throw new UnexceptedEndOfFileException();
                                                            if(f.charAt(++i)=='a' && f.charAt(++i)=='p' && f.charAt(++i)=='a' &&
                                                                  f.charAt(++i)=='x' && f.charAt(++i)=='e' && f.charAt(++i)=='s' &&
                                                                  (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                               f.charAt(i)>'Z'))
                                                                  throw new NotYetManagedException("swapaxes", nLine);//$NON-NLS-1$
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      
                                                      default :
                                                            i=i2;
                                                            throw new UnknownCommandException(nLine);
                                                }                                               
                                                break ;
                                                
                                                
                                                      
                                                case 'b' :
                                                      i2 = i;
                                                      i++;
                                                      if(i>=lgth)
                                                      {
                                                            if(!started) throw new IgnoreCommandException(nLine);
                                                            throw new UnexceptedEndOfFileException();
                                                      }
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 'l' : //bl
                                                                  if(!started) { i=i2; throw new IgnoreCommandException(nLine);}
                                                                  i++;
                                                                  if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  switch(f.charAt(i))
                                                                  {
                                                                        case 'a' : // black
                                                                              if(i+3>=lgth) throw new UnexceptedEndOfFileException();

                                                                              PSTricksParameters tp = params.lastElement();
                                                                              if(f.charAt(++i)=='c' && f.charAt(++i)=='k' && (f.charAt(++i)<'a' || 
                                                                                    f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    tp.textColor = Color.BLACK;
                                                                              else
                                                                              {
                                                                                    i = i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        case 'u' : // blue
                                                                              if(i+2>=lgth) throw new UnexceptedEndOfFileException();

                                                                              tp = params.lastElement();
                                                                              if(f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                    f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                    tp.textColor = Color.BLUE;
                                                                              else
                                                                              {
                                                                                    i = i2;
                                                                                    throw new UnknownCommandException(nLine);
                                                                              }
                                                                              break;
                                                                              
                                                                        default :
                                                                              i=i2;
                                                                              if(started)throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                            

                                                            case 'e' : //be
                                                                  if(i+4>=lgth) 
                                                                  {
                                                                        if(!started) throw new IgnoreCommandException(nLine);
                                                                        throw new UnexceptedEndOfFileException();
                                                                  }
                                                                  if(f.charAt(++i)=='g' && f.charAt(++i)=='i' && f.charAt(++i)=='n' && 
                                                                     (f.charAt(++i)<'a'  || f.charAt(i)>'z')&& (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                  {//begin
                                                                        while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                        {
                                                                              if(f.charAt(i)==eol) nLine++;
                                                                              i++;
                                                                              if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        }
                                                                        if(f.charAt(i)=='{')
                                                                        {//begin{
                                                                              i++;
                                                                              if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                              while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                              {
                                                                                    if(f.charAt(i)==eol) nLine++;
                                                                                    i++;
                                                                                    if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                              }
                                                                              if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                                              
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'p'://begin{p
                                                                                          if(i+9>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='s' && f.charAt(++i)=='p' &&
                                                                                             f.charAt(++i)=='i' && f.charAt(++i)=='c' && f.charAt(++i)=='t' &&
                                                                                             f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' &&
                                                                                             (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {//begin{pspicture
                                                                                                while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                {
                                                                                                      if(f.charAt(i)==eol) nLine++;
                                                                                                      i++;
                                                                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                }
                                                                                                if(f.charAt(i)=='}')
                                                                                                {//begin{pspicture}
                                                                                                      if(started)
                                                                                                            throw new FatalErrorParsingException(
                                                                                                            LaTeXDrawLang.getString1_6("PSTricksParser.1")+ //$NON-NLS-1$
                                                                                                            LaTeXDrawLang.getString1_6("PSTricksParser.2")); //$NON-NLS-1$
                                                                                                      started = true;
                                                                                                      startedWithBeginPs = true;
                                                                                                      Point2D.Double pt1, pt2;
                                                                                                      String sub = f.substring(i);
                                                                                                      try 
                                                                                                      {
                                                                                                            pt1 = PSTricksParserActionsManager.readOneCoordinate(sub, 0, nLine, true);
                                                                                                            i += sub.indexOf(")", 0);//$NON-NLS-1$
                                                                                                      }catch(Exception e)
                                                                                                      { 
                                                                                                            throw new FatalErrorParsingException("Invalid command begin{pspicture}");//$NON-NLS-1$
                                                                                                      }
                                                                                                      
                                                                                                      int j, k = ++i;
                                                                                                      try 
                                                                                                      { // optional
                                                                                                            while(k<lgth && (PSTricksParserActionsManager.isCharToIgnore(f.charAt(k)) || 
                                                                                                                        f.charAt(k)=='\\'))
                                                                                                                  k++;
                                                                                                      
                                                                                                            if(f.charAt(k)!='(') throw new IgnoreCommandException(-1);
                                                                                                            j = f.indexOf(')', k);
                                                                                                            sub = f.substring(k, j+1);
                                                                                                            pt2 = PSTricksParserActionsManager.readOneCoordinate(sub, 0, nLine, true);
                                                                                                            i = j;
                                                                                                      }catch(IgnoreCommandException e)
                                                                                                      {
                                                                                                            pt2 = pt1;
                                                                                                            pt1 = new Point2D.Double(0,0);
                                                                                                      }
                                                                                                      catch(Exception e)
                                                                                                      {
                                                                                                            throw new FatalErrorParsingException("Invalid command begin{pspicture}");//$NON-NLS-1$
                                                                                                      }
                                                                                                      
                                                                                                      PSTricksParameters.pictureNEPt = pt2;
                                                                                                      PSTricksParameters.pictureSWPt = pt1;
                                                                                                      params.add(new PSTricksParameters());
                                                                                                      
                                                                                                }else throw new InvalidFormatCommandException("\\begin{pspicture}", nLine);//$NON-NLS-1$
                                                                                          }else
                                                                                          {
                                                                                                i = i2;
                                                                                                if(started) throw new UnknownCommandException(nLine);
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'c'://begin{c
                                                                                          if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='e' && f.charAt(++i)=='n' &&
                                                                                             f.charAt(++i)=='t' && f.charAt(++i)=='e' && 
                                                                                             f.charAt(++i)=='r' && (f.charAt(++i)<'a' || 
                                                                                             f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {//begin{center
                                                                                                while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                {
                                                                                                      if(f.charAt(i)==eol) nLine++;
                                                                                                      i++;
                                                                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                }
                                                                                                if(f.charAt(i)=='}') //begin{center}
                                                                                                {
                                                                                                      if(started && !parsingFinished)
                                                                                                            throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.0")); //$NON-NLS-1$
                                                                                                      
                                                                                                      PSTricksParameters.isCentered = true;
                                                                                                }
                                                                                                else 
                                                                                                      throw new InvalidFormatCommandException("\\begin{center}", nLine);//$NON-NLS-1$
                                                                                          }else
                                                                                          {
                                                                                                i = i2;
                                                                                                if(started) throw new UnknownCommandException(nLine);
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'f'://begin{f
                                                                                          if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='i' && f.charAt(++i)=='g' &&
                                                                                             f.charAt(++i)=='u' && f.charAt(++i)=='r' && 
                                                                                             f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                             f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {//begin{figure
                                                                                                while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                {
                                                                                                      if(f.charAt(i)==eol) nLine++;
                                                                                                      i++;
                                                                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                }
                                                                                                if(f.charAt(i)=='}') //begin{figure}
                                                                                                      i += PSTricksParserActionsManager.parseBeginFigureCmd(f.substring(++i), nLine);
                                                                                                else throw new InvalidFormatCommandException("\\begin{pspicture}", nLine);//$NON-NLS-1$
                                                                                                      
                                                                                          }else
                                                                                          {
                                                                                                i = i2;
                                                                                                if(started) throw new UnknownCommandException(nLine);
                                                                                                throw new IgnoreCommandException(nLine);
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    default :
                                                                                          i = i2;
                                                                                          if(!started) throw new IgnoreCommandException(nLine);
                                                                                          throw new IgnoreCommandException(nLine);
                                                                              }
                                                                        }
                                                                        else
                                                                        {
                                                                              i = i2;
                                                                              if(!started) throw new IgnoreCommandException(nLine);
                                                                              throw new IgnoreCommandException(nLine);
                                                                        }
                                                                  }else
                                                                  {
                                                                        i = i2;
                                                                        if(!started) throw new IgnoreCommandException(nLine);
                                                                        throw new IgnoreCommandException(nLine);
                                                                  }
                                                                  break;
                                                            
                                                            
                                                            case 'f' : // bf
                                                                  if(!started) { i=i2; throw new IgnoreCommandException(nLine);}
                                                                  if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if((f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        tp.textBold = true;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new IgnoreCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'o' : // box
                                                                  if(!started)  { i=i2; throw new IgnoreCommandException(nLine); }
                                                                  if(i+2>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  if(f.charAt(++i)=='x' && (f.charAt(++i)<'a' || 
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                        throw new NotYetManagedException("box", nLine);//$NON-NLS-1$
                                                                        
                                                                  i = i2;
                                                                  throw new IgnoreCommandException(nLine);
                                                            
                                                            default :
                                                                  i=i2;
                                                                  if(started) throw new UnknownCommandException(nLine);
                                                                  throw new IgnoreCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 'l' :
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      i2 = i;
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 'a' : // large
                                                                  if(i+4>=lgth) throw new UnexceptedEndOfFileException();

                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if(f.charAt(++i)=='r' && f.charAt(++i)=='g' && f.charAt(++i)=='e' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        tp.textSize = PSTricksConstants.COMMAND_TEXT_LARGE1;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'd' : // ldots
                                                                  if(i+4>=lgth) throw new UnexceptedEndOfFileException();

                                                                  if(f.charAt(++i)=='o' && f.charAt(++i)=='t' && f.charAt(++i)=='s' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        throw new NotYetManagedException("ldots", nLine);//$NON-NLS-1$
                                                                        
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                                  
                                                            case 'i'://li
                                                                  if(i+4>=lgth) throw new UnexceptedEndOfFileException();

                                                                  if(f.charAt(++i)=='n' && f.charAt(++i)=='e' && f.charAt(++i)=='t' &&
                                                                        f.charAt(++i)=='o' &&(f.charAt(++i)<'a' || 
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        int end = texParserActions.actionsOnLineTo(nLine, 
                                                                                    params, f.substring(i, f.length()));
                                                                        if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i=i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                break;

                                                case '%' :
                                                      if(started)
                                                      {
                                                            PSTricksParameters p = params.lastElement();
                                                            p.textParsed+='%';
                                                      }
                                                      i++;
                                                      break;
                                                
                                                      
                                                case 'e' :
                                                      i2 = i;
                                                      
                                                      if(i+3>=lgth) 
                                                      {
                                                            if(started) throw new UnexceptedEndOfFileException();
                                                            throw new IgnoreCommandException(nLine);
                                                      }
                                                      
                                                      if(f.charAt(++i)=='n' && f.charAt(++i)=='d')
                                                      {//end
                                                            ++i;
                                                            
                                                            if(f.charAt(i)=='p')
                                                            {//endp
                                                                  if(f.charAt(++i)=='s' && f.charAt(++i)=='p' && f.charAt(++i)=='i' && f.charAt(++i)=='c' &&
                                                                        f.charAt(++i)=='t' && f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {//endpspicture
                                                                        if(!started || (started && startedWithBeginPs))
                                                                              throw new FatalErrorParsingException("\\endpspicture must come after \\pspicture");//$NON-NLS-1$
                                                                        
                                                                        parsingFinished = true;
                                                                        i++;
                                                                  }
                                                                  else
                                                                  {
                                                                        if(started) throw new UnknownCommandException(nLine);
                                                                        throw new IgnoreCommandException(nLine);
                                                                  }
                                                            }
                                                            else
                                                            {
                                                                   if((f.charAt(i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                   {
                                                                        while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                        {
                                                                              if(f.charAt(i)==eol) nLine++;
                                                                              i++;
                                                                              if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        }
                                                                        if(f.charAt(i)=='{')
                                                                        {//end{
                                                                              i++;
                                                                              if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                              while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                              {
                                                                                    if(f.charAt(i)==eol) nLine++;
                                                                                    i++;
                                                                                    if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                              }
                                                                              
                                                                              switch(f.charAt(i))
                                                                              {
                                                                                    case 'p'://end{p
                                                                                          if(i+9>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='s' && f.charAt(++i)=='p' &&
                                                                                             f.charAt(++i)=='i' && f.charAt(++i)=='c' && f.charAt(++i)=='t' &&
                                                                                             f.charAt(++i)=='u' && f.charAt(++i)=='r' && f.charAt(++i)=='e' &&
                                                                                             (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                                             f.charAt(i)>'Z'))
                                                                                          {//end{pspicture
                                                                                                while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                {
                                                                                                      if(f.charAt(i)==eol) nLine++;
                                                                                                      i++;
                                                                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                }
                                                                                                if(f.charAt(i)=='}')
                                                                                                {//end{pspicture}
                                                                                                      if(!started || (started && !startedWithBeginPs))
                                                                                                            throw new FatalErrorParsingException("end{pspicture} must come after begin{pspicture}");//$NON-NLS-1$
                                                                                                      
                                                                                                      parsingFinished = true;
                                                                                                      i++;
                                                                                                }
                                                                                                else 
                                                                                                      throw new InvalidFormatCommandException("\\end{pspicture}", nLine);//$NON-NLS-1$
                                                                                          } //if(f.charAt(i)=='p' && f.charAt...
                                                                                          else
                                                                                          {
                                                                                                i = i2;
                                                                                                throw new UnexceptedEndOfFileException();
                                                                                          }
                                                                                    break;
                                                                                    
                                                                                    case 'c'://end{c
                                                                                          if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='e' && f.charAt(++i)=='n' &&
                                                                                             f.charAt(++i)=='t' && f.charAt(++i)=='e' && 
                                                                                             f.charAt(++i)=='r' && (f.charAt(++i)<'a' || 
                                                                                             f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {//end{center
                                                                                                while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                {
                                                                                                      if(f.charAt(i)==eol) nLine++;
                                                                                                      i++;
                                                                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                }
                                                                                                if(f.charAt(i)=='}') //end{center} 
                                                                                                {
                                                                                                      if(started && !parsingFinished)
                                                                                                            throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.1")); //$NON-NLS-1$
                                                                                                      
                                                                                                      if(started)
                                                                                                            parsingFinished = true;
                                                                                                      else
                                                                                                            PSTricksParameters.isCentered = false;
                                                                                                }
                                                                                                else 
                                                                                                      throw new InvalidFormatCommandException("\\end{center}", nLine);//$NON-NLS-1$
                                                                                          }else
                                                                                          {
                                                                                                i = i2;
                                                                                                throw new UnexceptedEndOfFileException();
                                                                                          }
                                                                                          break;
                                                                                          
                                                                                    case 'f'://end{f 
                                                                                          if(i+9>=lgth) throw new UnexceptedEndOfFileException();
                                                                                          if(f.charAt(++i)=='i' && f.charAt(++i)=='g' &&
                                                                                             f.charAt(++i)=='u' && f.charAt(++i)=='r' && 
                                                                                             f.charAt(++i)=='e' && (f.charAt(++i)<'a' || 
                                                                                             f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                                          {//end{figure
                                                                                                while(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                                                {
                                                                                                      if(f.charAt(i)==eol) nLine++;
                                                                                                      i++;
                                                                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                                                }
                                                                                                if(f.charAt(i)=='}') //end{figure} 
                                                                                                {
                                                                                                      if(started && !parsingFinished)
                                                                                                            throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.2")); //$NON-NLS-1$
                                                                                                      
                                                                                                      if(started)
                                                                                                            parsingFinished = true;
                                                                                                      else
                                                                                                            PSTricksParameters.tokenPosition = "";//$NON-NLS-1$
                                                                                                }
                                                                                                else 
                                                                                                      throw new InvalidFormatCommandException("\\end{figure}", nLine);//$NON-NLS-1$
                                                                                          }else
                                                                                          {
                                                                                                i = i2;
                                                                                                throw new UnexceptedEndOfFileException();
                                                                                          }
                                                                                          break;
                                                                              }
                                                                        }
                                                                        else
                                                                        {
                                                                              i = i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                        }
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                            }// if(f.charAt(++i)=='n' && f.charAt(++i)=...
                                                      }
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                      
                                                case 'd' : 
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      i2 = i;
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                      if(f.charAt(i)!='e')
                                                      {
                                                            i=i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();

                                                      switch(f.charAt(i))
                                                      {
                                                            case 'g' : // degrees
                                                                  if(i+5>=lgth) throw new UnexceptedEndOfFileException();

                                                                  if(f.charAt(++i)=='r' && f.charAt(++i)=='e' && f.charAt(++i)=='e' &&
                                                                        f.charAt(++i)=='s' && (f.charAt(++i)<'a' || 
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        int id = texParserActions.parseDegreesCommand(f.substring(i),params.lastElement(), nLine);
                                                                        i += id;
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'f' : // definecolor
                                                                  if(i+9>=lgth) throw new UnexceptedEndOfFileException();

                                                                  if(f.charAt(++i)=='i' && f.charAt(++i)=='n' && f.charAt(++i)=='e' &&
                                                                        f.charAt(++i)=='c' && (f.charAt(++i)=='o' && f.charAt(++i)=='l' &&
                                                                        f.charAt(++i)=='o' && f.charAt(++i)=='r' && f.charAt(++i)<'a' || 
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        int id1 = f.indexOf("{", i);//$NON-NLS-1$
                                                                        int id2 = f.indexOf("}", i);//$NON-NLS-1$
                                                                        
                                                                        if(id1==-1 || id2==-1) 
                                                                        {
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                        }
                                                                        
                                                                        int[] tmp = {0};
                                                                        String name = PSTricksParserActionsManager.readString(f.substring(id1, id2), tmp, true);
                                                                        
                                                                        if(name==null || name.length()==0)
                                                                        {
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                        }
                                                                        
                                                                        id1 = f.indexOf("{", id2);//$NON-NLS-1$
                                                                        id2 = f.indexOf("}", id2+1);//$NON-NLS-1$
                                                                        
                                                                        if(id1==-1 || id2==-1) 
                                                                        {
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                        }
                                                                        tmp[0]=0;
                                                                        String type = PSTricksParserActionsManager.readString(f.substring(id1, id2), tmp, true);
                                                                        
                                                                        if(name.length()==0)
                                                                        {
                                                                              i=i2;
                                                                              throw new UnknownCommandException(nLine);
                                                                        }
                                                                        
                                                                        id1 = f.indexOf("{", id2);//$NON-NLS-1$
                                                                        id2 = f.indexOf("}", id2+1);//$NON-NLS-1$
                                                                        tmp[0] = 0;
                                                                        String subStr = f.substring(id1+1, id2);
                                                                        
                                                                        if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_NAMED))
                                                                        { // definecolor{alias}{named}{colorName}
                                                                              String val1 = PSTricksParserActionsManager.readString(subStr, tmp, true);
                                                                              
                                                                              Color c = DviPsColors.getColour(val1);
                                                                              if(c!=null)
                                                                                    DviPsColors.addUserColour(c, name);
                                                                        }
                                                                        else
                                                                        {
                                                                              double val1 = PSTricksParserActionsManager.readReal(subStr, tmp, true);
                                                                              if(val1<0 || val1>1) throw new UnknownCommandException(nLine);
                                                                              
                                                                              if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_GRAY)) // definecolor{name}{gray}{val}
                                                                                    DviPsColors.addUserColour(new Color((float)val1, (float)val1, (float)val1), name);  
                                                                              else
                                                                              {
                                                                                    PSTricksParserActionsManager.readChar(subStr, ',', tmp);
                                                                                    double val2 = PSTricksParserActionsManager.readReal(subStr, tmp, true);
                                                                                    PSTricksParserActionsManager.readChar(subStr, ',', tmp);
                                                                                    double val3 = PSTricksParserActionsManager.readReal(subStr, tmp, true);
                                                                                    
                                                                                    if(val2<0 || val2>1 || val3<0 || val3>1) 
                                                                                          throw new UnknownCommandException(nLine);
                                                                                    
                                                                                    if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_RGB))// definecolor{name}{rgb}{r g b}
                                                                                          DviPsColors.addUserColour(new Color((float)val1, (float)val2, (float)val3), name);
                                                                                    else 
                                                                                          if(type.equals(PSTricksConstants.TOKEN_COLOR_TYPE_HSB))
                                                                                                DviPsColors.addUserColour(Color.getHSBColor((float)val1, (float)val2, (float)val3), name);
                                                                                          else
                                                                                                if(type.compareTo(PSTricksConstants.TOKEN_COLOR_TYPE_CMYK)==0)
                                                                  {
                                                                                                      PSTricksParserActionsManager.readChar(subStr, ',', tmp);
                                                                      double val4 = PSTricksParserActionsManager.readReal(subStr, tmp, true);
                                                                    
                                                                      if(val4<0 || val4>1)
                                                                          throw new InvalidFormatCommandException(nLine);
                                                                    
                                                                      DviPsColors.addUserColour(DviPsColors.CMYK2RGB(val1, val2, val3, val4), name);
                                                                   }
                                                                   else
                                                                       throw new UnknownCommandException(nLine); 
                                                                              }
                                                                        }
                                                                        i = id2+2;
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i-=2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                      
                                                case 'g' :
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      i2 = i;
                                                
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      if(f.charAt(i)!='r') 
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();

                                                      switch(f.charAt(i))
                                                      {
                                                            case 'a' : // gray
                                                                  if(i+2>=lgth) throw new UnexceptedEndOfFileException();

                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if(f.charAt(++i)=='y' && (f.charAt(++i)<'a' || 
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                        tp.textColor = Color.GRAY;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'e' : // green
                                                                  if(i+3>=lgth) throw new UnexceptedEndOfFileException();

                                                                  i2 = i;
                                                                  tp = params.lastElement();
                                                                  if(f.charAt(++i)=='e' && f.charAt(++i)=='n' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        tp.textColor = Color.GREEN;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i=i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                      
                                                case 'L' :
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                
                                                      i2 = i;
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 'A' : // LARGE
                                                                  if(i+4>=lgth) throw new UnexceptedEndOfFileException();

                                                                  i2 = i;
                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if(f.charAt(++i)=='R' && f.charAt(++i)=='G' && f.charAt(++i)=='E' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        tp.textSize = PSTricksConstants.COMMAND_TEXT_LARGE3;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'a' : // Large
                                                                  if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  i2 = i;
                                                                  tp = params.lastElement();
                                                                  if(f.charAt(++i)=='r' && f.charAt(++i)=='g' && f.charAt(++i)=='e' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                        f.charAt(i)>'Z'))
                                                                        tp.textSize = PSTricksConstants.COMMAND_TEXT_LARGE2;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i=i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 'q' :
                                                
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      i2 = i;
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 'l' : // qline
                                                                  if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                  i2 = i;
                                                                  if(f.charAt(++i)=='i' && f.charAt(++i)=='n' && f.charAt(++i)=='e' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        throw new NotYetManagedException("qline", nLine);//$NON-NLS-1$
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                                  
                                                            case 'd' : // qdisk
                                                                  if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                                  i2 = i;
                                                                  if(f.charAt(++i)=='i' && f.charAt(++i)=='s' && f.charAt(++i)=='k' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        throw new NotYetManagedException("qdisk", nLine);//$NON-NLS-1$
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                                  
                                                            default :
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                                        
                                                      }

                                                case 'c' :
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                
                                                      i2 = i;
                                                      i++;
                                                      if(i>=lgth) throw new IgnoreCommandException(nLine);

                                                      switch(f.charAt(i))
                                                      {
                                                            case 'p' : // cput
                                                                  if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  i2 = i;
                                                                  if(f.charAt(++i)=='u' && f.charAt(++i)=='t' && (f.charAt(++i)=='*' ||
                                                                        f.charAt(i)=='[' || f.charAt(i)=='{'))
                                                                        throw new NotYetManagedException("cput", nLine);//$NON-NLS-1$
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                            
                                                            case 'y' : // cyan
                                                                  if(i+3>=lgth) throw new IgnoreCommandException(nLine);

                                                                  i2 = i;
                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if(f.charAt(++i)=='a' && f.charAt(++i)=='n' && 
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                        f.charAt(i)>'Z'))
                                                                        tp.textColor = Color.CYAN;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'o': // color
                                                                  if(i+4>lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  if(f.charAt(++i)=='l' && f.charAt(++i)=='o' && 
                                                                     f.charAt(++i)=='r' && (f.charAt(++i)=='{' || PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))))
                                                                  {
                                                                        while(i<lgth && f.charAt(i)!='{') i++; // We search the '{'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        int[] id = {0};
                                                                        tp = params.lastElement();
                                                                        String tmp = PSTricksParserActionsManager.readString(f.substring(i), id, true);
                                                                        Color c = DviPsColors.getColour(tmp); // We search the color
                                                                        if(c!=null) tp.textColor = c;
                                                                        while(i<lgth && f.charAt(i)!='}') i++; // We search the '{'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'u'://cu
                                                                  if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  i2 = i;
                                                                  if(f.charAt(++i)=='r' && f.charAt(++i)=='v' && f.charAt(++i)=='e' &&
                                                                        f.charAt(++i)=='t' && f.charAt(++i)=='o' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                           f.charAt(i)>'Z'))//curveto
                                                                  {
                                                                        int end = texParserActions.actionsOnCurveTo(nLine, 
                                                                                                params, f.substring(i, f.length()));
                                                                        if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'l'://cl
                                                                  if(i+8>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  i2 = i;
                                                                  if(f.charAt(++i)=='o' && f.charAt(++i)=='s' && f.charAt(++i)=='e' &&
                                                                        f.charAt(++i)=='p' && f.charAt(++i)=='a' &&
                                                                        f.charAt(++i)=='t' && f.charAt(++i)=='h' &&
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                           f.charAt(i)>'Z'))//closepath
                                                                        texParserActions.actionsOnClosePathCommand(nLine);
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 't' :
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      
                                                      i2 = i;
                                                      i++;
                                                      if(i>=lgth) throw new UnexceptedEndOfFileException();

                                                      switch(f.charAt(i))
                                                      {
                                                            case 'r' ://translate
                                                                  if(i+8>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  i2 = i;
                                                                  if(f.charAt(++i)=='a' && f.charAt(++i)=='n' && f.charAt(++i)=='s' && 
                                                                     f.charAt(++i)=='l' && f.charAt(++i)=='a' && f.charAt(++i)=='t' && 
                                                                     f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                     (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                        throw new NotYetManagedException("translate", nLine);//$NON-NLS-1$
                                                                  
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                                  
                                                                  
                                                            case 'i' : //tiny
                                                                  if(i+3>=lgth) throw new UnexceptedEndOfFileException();

                                                                  i2 = i;
                                                                  PSTricksParameters tp = params.lastElement();
                                                                  if(f.charAt(++i)=='n' && f.charAt(++i)=='y' && 
                                                                    (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || 
                                                                     f.charAt(i)>'Z'))
                                                                        tp.textSize = PSTricksConstants.COMMAND_TEXT_TINY;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 'u' :
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      i2 = i;
                                                      if(++i>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 'p' : // uput
                                                                  if(i+3>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  if(f.charAt(++i)=='u' && f.charAt(++i)=='t' &&
                                                                     (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                     (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        int j = i;
                                                                        boolean brack = false, end=false;//, hasStar = f.charAt(i)=='*';
                                                                        
                                                                        while(j<lgth && !end) 
                                                                        { // We extract the command the string : uput*{..}[..]{..}(..){...
                                                                              if(f.charAt(j)=='(') brack = true;
                                                                              else if(f.charAt(j)=='{' && brack) end = true;
                                                                              j++; 
                                                                        }
                                                                        if(++j>=lgth) throw new UnexceptedEndOfFileException();

                                                                  //    String uputS = f.substring(i, j);
                                                                  //    try{AbstractPSTricksParserActions.parseuputCommand(uputS, hasStar, params);}
                                                                  //    catch(Exception e){ e.printStackTrace(); throw new InvalidFormatCommandException("uput", nLine); }
                                                                        i = j-2;
                                                                        throw new NotYetManagedException("uput", nLine);//$NON-NLS-1$
                                                                  }//else
                                                                  //{
                                                                        i=i2;
                                                                        throw new IgnoreCommandException(nLine);
                                                                  //}
                                                            //    break;
                                                                  
                                                            case 's' : // usefont{enc}{family}{series}{shape}
                                                                  if(i+6>lgth) { i = i2; throw new UnknownCommandException(nLine); }
                                                                  
                                                                  if(f.charAt(++i)=='e' && f.charAt(++i)=='f' && 
                                                                     f.charAt(++i)=='o' && f.charAt(++i)=='n' && f.charAt(++i)=='t' && 
                                                                     (f.charAt(++i)=='{' || PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))))
                                                                  {
                                                                        PSTricksParameters tp = params.lastElement();
                                                                        while(i<lgth && f.charAt(i)!='{') i++; // We search the '{'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        
                                                                        int[] tmp = {0};
                                                                        tp.textEnc = PSTricksParserActionsManager.readString(f.substring(i), tmp, true);
                                                                        while(i<lgth && f.charAt(i)!='}') i++; // We search the '}'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        while(i<lgth && f.charAt(i)!='{') i++; // We search the '{'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        tmp[0] = 0;
                                                                        tp.textFamily = PSTricksParserActionsManager.readString(f.substring(i), tmp, true);
                                                                        while(i<lgth && f.charAt(i)!='}') i++; // We search the '}'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        while(i<lgth && f.charAt(i)!='{') i++; // We search the '{'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        tmp[0] = 0;
                                                                        tp.textSeries = PSTricksParserActionsManager.readString(f.substring(i), tmp, true);
                                                                        while(i<lgth && f.charAt(i)!='}') i++; // We search the '}'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        while(i<lgth && f.charAt(i)!='{') i++; // We search the '{'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                        tmp[0] = 0;
                                                                        tp.textShape = PSTricksParserActionsManager.readString(f.substring(i), tmp, true);
                                                                        while(i<lgth && f.charAt(i)!='}') i++; // We search the '}'
                                                                        if(i>=lgth) throw new UnexceptedEndOfFileException();
                                                                        i++;
                                                                  }else 
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default :
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      } // switch(f.charAt(i))
                                                      break;
                                                      
                                                
                                                case 'H' :  // Huge
                                                      if(!started)  throw new IgnoreCommandException(nLine);
                                                      if(i+4>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      i2 = i;
                                                      PSTricksParameters tp = params.lastElement();
                                                      if(f.charAt(++i)=='u' && f.charAt(++i)=='g' && f.charAt(++i)=='e' &&
                                                        (f.charAt(++i)<'a' ||  f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                            tp.textSize = PSTricksConstants.COMMAND_TEXT_HUGE2;
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                            
                                                case 'N' : //NormalCoor
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      if(i+11>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      i2 = i;
                                                      tp = params.lastElement();
                                                      if(f.charAt(++i)=='o' && f.charAt(++i)=='r' && f.charAt(++i)=='m' && 
                                                            f.charAt(++i)=='a' && f.charAt(++i)=='l' && 
                                                            f.charAt(++i)=='C' && f.charAt(++i)=='o' && f.charAt(++i)=='o' && 
                                                            f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                            (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                            tp.specialCoor = false;
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                      
                                                case 'S' : //SpecialCoor
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      if(i+11>=lgth) throw new UnexceptedEndOfFileException();
                                                
                                                      i2 = i;
                                                      tp = params.lastElement();
                                                      if(f.charAt(++i)=='p' && f.charAt(++i)=='e' && f.charAt(++i)=='c' && 
                                                            f.charAt(++i)=='i' && f.charAt(++i)=='a' && f.charAt(++i)=='l' && 
                                                            f.charAt(++i)=='C' && f.charAt(++i)=='o' && f.charAt(++i)=='o' && 
                                                            f.charAt(++i)=='r' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                            (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                            tp.specialCoor = true;
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                      
                                                case 'f': //f
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                      i2 = i;
                                                      
                                                      switch(f.charAt(++i))
                                                      {
                                                            case 'o'://fo
                                                                  if(i+11>=lgth) throw new UnexceptedEndOfFileException();
                                                            
                                                                  tp = params.lastElement();
                                                                  if(f.charAt(++i)=='o' && f.charAt(++i)=='t' &&// footnodesize
                                                                        f.charAt(++i)=='n' && f.charAt(++i)=='o' && f.charAt(++i)=='t' &&
                                                                        f.charAt(++i)=='e' && f.charAt(++i)=='s' && f.charAt(++i)=='i' &&
                                                                        f.charAt(++i)=='z' && f.charAt(++i)=='e' &&(f.charAt(++i)<'a' ||  
                                                                        f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                        tp.textSize = PSTricksConstants.COMMAND_TEXT_FOOTNOTE;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'i'://fi
                                                                  if(i+3>=lgth) throw new UnexceptedEndOfFileException();

                                                                  if(f.charAt(++i)=='l' && f.charAt(++i)=='l' && 
                                                                        (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                        (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                        throw new NotYetManagedException("fill", nLine);//$NON-NLS-1$
                                                                        
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                                  
                                                            default:
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 'h' :  // huge
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      if(i+4>=lgth) throw new UnexceptedEndOfFileException();

                                                      i2 = i;
                                                      tp = params.lastElement();
                                                      if(f.charAt(++i)=='u' && f.charAt(++i)=='g' && f.charAt(++i)=='e' &&
                                                        (f.charAt(++i)<'a' ||  f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                            tp.textSize = PSTricksConstants.COMMAND_TEXT_HUGE1;
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 'm' : // m
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      
                                                      if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                      i2 = i;
                                                      
                                                      switch(f.charAt(++i))
                                                      {
                                                            case 'a'://ma
                                                                  if(i+5>=lgth) throw new UnexceptedEndOfFileException();
            
                                                                  tp = params.lastElement();
                                                                  if(f.charAt(++i)=='g' && f.charAt(++i)=='e' &&//magenta
                                                                     f.charAt(++i)=='n' && f.charAt(++i)=='t' && (f.charAt(++i)<'a' || 
                                                                     f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                        tp.textColor = Color.MAGENTA;
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            case 'o'://mo
                                                                  if(i+5>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  tp = params.lastElement();
                                                                  if(f.charAt(++i)=='v' && f.charAt(++i)=='e' &&
                                                                     f.charAt(++i)=='t' && f.charAt(++i)=='o' && (f.charAt(++i)<'a' || 
                                                                     f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        int end = texParserActions.actionsOnMoveTo(nLine, 
                                                                                                params, f.substring(i, f.length()));
                                                                        if(end!=PSTricksParserActionsManager.ERR_END_CMD_INDEX) i+=end;
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                                  
                                                            default:
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 'y' : // yellow
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                
                                                      i2 = i;
                                                      tp = params.lastElement();
                                                      if(f.charAt(++i)=='e' && f.charAt(++i)=='l' && f.charAt(++i)=='l' &&
                                                         f.charAt(++i)=='o' && f.charAt(++i)=='w' && (f.charAt(++i)<'a' || 
                                                         f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                            tp.textColor = Color.YELLOW;
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                case 'i' : 
                                                      i2 = i;
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      if(++i>=lgth) throw new UnexceptedEndOfFileException();
                                                      
                                                      switch(f.charAt(i))
                                                      {
                                                            case 't' : // it
                                                                  if(i+1>=lgth) throw new UnexceptedEndOfFileException();
                                                            
                                                                  if((f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                     (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                                  {
                                                                        tp = params.lastElement();
                                                                        tp.textItalic = true;
                                                                  }
                                                                  else
                                                                  {
                                                                        i = i2;
                                                                        throw new UnknownCommandException(nLine);
                                                                  }
                                                                  break;
                                                            
                                                            case 'n' : // in
                                                                  if(i+14>=lgth) throw new UnexceptedEndOfFileException();
                                                                  
                                                                  if(f.charAt(++i)=='c' && f.charAt(++i)=='l' && f.charAt(++i)=='u' &&
                                                                        f.charAt(++i)=='d' && f.charAt(++i)=='e' && f.charAt(++i)=='g' &&
                                                                        f.charAt(++i)=='r' && f.charAt(++i)=='a' && f.charAt(++i)=='p' &&
                                                                        f.charAt(++i)=='h' && f.charAt(++i)=='i' && f.charAt(++i)=='c' &&
                                                                        f.charAt(++i)=='s' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                                     (f.charAt(i)<'A' || f.charAt(i)>'Z')) // includegraphics
                                                                  {
                                                                        int z = texParserActions.actionsOnPicture(nLine, params, f.substring(i));
                                                                        if(z>0) i+=z;
                                                                        throw new NotYetManagedException("includegraphics", nLine); //$NON-NLS-1$
                                                                  }
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                                  
                                                            default :
                                                                  i = i2;
                                                                  throw new UnknownCommandException(nLine);
                                                      }
                                                      
                                                break;
                                                      
                                                case 'w' :// white
                                                      if(!started)   throw new IgnoreCommandException(nLine);
                                                      if(i+5>=lgth) throw new UnexceptedEndOfFileException();

                                                      i2 = i;
                                                      tp = params.lastElement();
                                                      if(f.charAt(++i)=='h' && f.charAt(++i)=='i' && f.charAt(++i)=='t' &&
                                                         f.charAt(++i)=='e' && (f.charAt(++i)<'a' || f.charAt(i)>'z') && 
                                                         (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                            tp.textColor = Color.WHITE;
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                      
                                                      
                                                case 'z' : //z
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      
                                                      i2 = i;//zigzag
                                                      if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                      if(f.charAt(++i)=='i' && f.charAt(++i)=='g' && f.charAt(++i)=='z' &&
                                                         f.charAt(++i)=='a' && f.charAt(++i)=='g' && (f.charAt(++i)<'a' || 
                                                         f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                             throw new NotYetManagedException("zigzag", nLine);//$NON-NLS-1$
                                                      
                                                      i = i2;
                                                      throw new UnknownCommandException(nLine);
                                                      
                                                case 'o'://o
                                                      if(!started) throw new IgnoreCommandException(nLine);
                                                      
                                                      i2 = i;
                                                      if(i+6>=lgth) throw new UnexceptedEndOfFileException();
                                                      if(f.charAt(++i)=='p' && f.charAt(++i)=='e' && f.charAt(++i)=='n' &&
                                                         f.charAt(++i)=='s' && f.charAt(++i)=='h' && f.charAt(++i)=='a' &&
                                                         f.charAt(++i)=='d' && f.charAt(++i)=='o' && f.charAt(++i)=='w' &&
                                                         (f.charAt(++i)<'a' || f.charAt(i)>'z') && (f.charAt(i)<'A' || f.charAt(i)>'Z'))
                                                      {
                                                            int end = texParserActions.parseOpenShadowCommand(params.lastElement(), nLine,
                                                                                                      f.substring(i));
                                                            if(end!=-1)
                                                                  i+=end;
                                                      }
                                                      else
                                                      {
                                                            i = i2;
                                                            throw new UnknownCommandException(nLine);
                                                      }
                                                      break;
                                                      
                                                default :
                                                      if(f.charAt(i)==eol)
                                                      {
                                                            nLine++;
                                                            i++;
                                                      }
                                                      else 
                                                      {
                                                            if(started)// throw new UnknownCommandException(nLine);
                                                            {
                                                                  if(!PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                                                  {
                                                                        PSTricksParameters p = params.lastElement();
                                                                        String str = "\\" + String.valueOf(f.charAt(i)); //$NON-NLS-1$
                                                                        
                                                                        p.textForFrame += str;
                                                                        p.textParsed   += str;
                                                                        
                                                                        if(p.fromFramedBox)
                                                                        {
                                                                              boolean again = true;
                                                                              int k = params.size()-2;
                                                                              
                                                                              while(again && k>=0)
                                                                              {
                                                                                    p = params.elementAt(k);
                                                                                    p.textForFrame += str;
                                                                                    
                                                                                    if(p.getPosition()!=null)
                                                                                          again = false;
                                                                                    else 
                                                                                          k--;
                                                                              }
                                                                        }
                                                                  }
                                                                  i++;
                                                            }
                                                            else throw new IgnoreCommandException(nLine);
                                                      }
                                          } //switch(f.charAt(i))
                                          
                                          // Any space after a command must not be taken like a text.
                                          while(i<lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i))) i++;
                                          break;
                                    
                                          
                                    case '{' :
                                          if(started)
                                                params.add(new PSTricksParameters(params.lastElement()));
                                          
                                          if(isFramedBox)
                                          {
                                                params.lastElement().fromFramedBox = true;
                                                isFramedBox = false;
                                          }
                                          i++;
                                          break;
                                          
                                          
                                    case '}' :
                                          if(started)
                                          {
                                                if(params.size()<2)
                                                      throw new TooManyBracketsException(nLine);
                                                      
                                                PSTricksParameters tp = params.lastElement();
                                                
                                                if(tp.fromFramedBox)
                                                {
                                                      PSTricksParameters pp = null;
                                                      int k = params.size()-1;
                                                      
                                                      while(pp==null && k>=0)
                                                            if(params.elementAt(k).getPosition()==null)
                                                                  k--;
                                                            else
                                                                  pp = params.elementAt(k);
                                                      
                                                      if(pp==null)
                                                            pp = params.firstElement();
                                                      
                                                      pp.psBox.lastElement().setEnd(pp.textForFrame.length());
                                                      pp.psBox.add(0, pp.psBox.remove(pp.psBox.size()-1));
                                                }
                                                else
                                                      if(tp.getPosition()!=null && !tp.psBox.isEmpty())
                                                      {
                                                            Vector<FramedBox> fbs = new Vector<FramedBox>();
                                                            while(!tp.psBox.isEmpty())
                                                                  fbs.add(tp.psBox.remove(tp.psBox.size()-1));
                                                            tp.psBox = fbs;
                                                                  
                                                            tp.psBoxText.setText(tp.textForFrame);
                                                            texParserActions.actionsOnTerminatedFramedBoxes(params);
                                                      }
                                                      else
                                                            if(tp.psCustomP.fromPsCustom)
                                                            {
                                                                  try
                                                                  {
                                                                        texParserActions.actionsOnterminatedPsCustom(params.lastElement());
                                                                        i++;
                                                                        if(params.isEmpty())//A enlever quand la commande sera totalement gérée.
                                                                              throw new TooManyBracketsException(nLine);
                                                                        
                                                                  }catch(NotFullyManagedException e)
                                                                  {//A enlever quand la commande sera totalement gérée.
                                                                        i++;
                                                                        if(params.isEmpty())
                                                                              throw new TooManyBracketsException(nLine);
                                                                        
                                                                        params.removeElementAt(params.size()-1);
                                                                        throw new NotFullyManagedException("pscustom", nLine);//$NON-NLS-1$
                                                                  }
                                                            }
                                                            else
                                                                  try {texParserActions.actionsOnText(params);}
                                                                  catch(InvalidFormatCommandException e) { /* Nothing to do.*/ }
                                                
                                                params.removeElementAt(params.size()-1);
                                          }
                                          i++;
                                          break;
                                          
                                    case ' ' :
                                    case 9 ://'\t'
                                          if(started)
                                          {
                                                PSTricksParameters p = params.lastElement();
                                                
                                                p.textForFrame+=" ";//$NON-NLS-1$
                                                p.textParsed+=" ";//$NON-NLS-1$
                                                
                                                if(p.fromFramedBox)
                                                {
                                                      boolean again=true;
                                                      int k = params.size()-2;
                                                      
                                                      while(again && k>=0)
                                                      {
                                                            p = params.elementAt(k);
                                                            p.textForFrame+=" ";//$NON-NLS-1$
                                                            
                                                            if(p.getPosition()==null)
                                                                  k--;
                                                            else
                                                                  again = false;
                                                      }
                                                }
                                          }
                                          i++;
                                          break;
                                          
                                          
                                    default : 
                                          if(PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                          {
                                                if(started)
                                                {
                                                      if(!lastTokenIsEOL && f.charAt(i)!=10)
                                                      {
                                                            if(params.isEmpty())
                                                                  throw new TooManyBracketsException(nLine);
                                                            PSTricksParameters p = params.lastElement();
                                                            p.textForFrame+=" ";//$NON-NLS-1$
                                                            p.textParsed+=" ";//$NON-NLS-1$
                                                      
                                                            if(p.fromFramedBox)
                                                            {
                                                                  boolean again = true;
                                                                  int k = params.size()-2;
                                                                  while(again && k>=0)
                                                                  {
                                                                        p = params.elementAt(k);
                                                                        p.textForFrame+=" ";//$NON-NLS-1$
                                                                        
                                                                        if(p.getPosition()!=null)
                                                                              again = false;
                                                                        else 
                                                                              k--;
                                                                  }
                                                            }
                                                            lastTokenIsEOL = true;
                                                      }
                                                }
                                                i++;
                                                if(f.charAt(i)!=10) nLine++;
                                          }
                                          else
                                          {
                                                if(started)
                                                {
                                                      PSTricksParameters p = params.lastElement();
                                                      String str = String.valueOf(f.charAt(i));
                                                      
                                                      p.textForFrame+=str;
                                                      p.textParsed+=str;
                                                      if(p.fromFramedBox)
                                                      {
                                                            boolean again = true;
                                                            int k = params.size()-2;
                                                            while(again && k>=0)
                                                            {
                                                                  p = params.elementAt(k);
                                                                  p.textForFrame+=str;
                                                                  
                                                                  if(p.getPosition()!=null)
                                                                        again = false;
                                                                  else 
                                                                        k--;
                                                            }
                                                      }
                                                }//if
                                                i++;
                                          }//else
                                          break;
                              } // switch(f.charAt(i))
                              
                        }catch(InvalidFormatCommandException e)
                        {     
                              parserMsgs.add(new ParserCmdMessage(e.getNLine(), e, e.getCommand()));
                              
                        }catch(NotYetManagedException e)
                        {
                              parserMsgs.add(new ParserCmdMessage(e.getNLine(), e, e.getCommand()));
                              
                        }catch(UnknownCommandException e)
                        {
                              String cmd = String.valueOf(f.charAt(i));
                              i++;
                              while(i<lgth && (f.charAt(i)>='a' && f.charAt(i)<='z') || (f.charAt(i)>='A' && f.charAt(i)<='Z'))
                                    cmd+=f.charAt(i++);
                              
                              if(latexCommandsWithBrackets.containsValue(cmd))
                              {
                                    PSTricksParameters p = params.lastElement();
                                    
                                    p.textParsed+="\\"+cmd; //$NON-NLS-1$
                                    
                                    while(i<lgth && PSTricksParserActionsManager.isCharToIgnore(f.charAt(i)))
                                          i++;
                                    
                                    if(f.charAt(i)=='{')
                                    {
                                          boolean despecialize = false;
                                          int cptBraces = 1;
                                          
                                          p.textParsed += f.charAt(i++);
                                          
                                          while(i<lgth && cptBraces>0)
                                          {
                                                if(!despecialize)
                                                {
                                                      if(f.charAt(i)=='}')
                                                            cptBraces--;
                                                      else if(f.charAt(i)=='{')
                                                                  cptBraces++;
                                                }
                                                
                                                despecialize = f.charAt(i)!='\\' || despecialize ? false : true;
                                                p.textParsed += f.charAt(i++);
                                          }
                                    }
                              }
                              else
                              {
                                    if(latexCommandsWithoutBrack.containsValue(cmd))
                                          params.lastElement().textParsed+="\\"+cmd; //$NON-NLS-1$
                                    else
                                    {
                                          e.printStackTrace();
                                          parserMsgs.add(new ParserCmdMessage(e.getNLine(), e, cmd));
                                    }
                              }
                        }
                        }catch(IgnoreCommandException e)
                        {
                              while(i<lgth && (f.charAt(i)>='a' && f.charAt(i)<='z') || (f.charAt(i)>='A' && f.charAt(i)<='Z'))
                                    i++;
                        }
                  }//while(i<lgth)
                  
                  if(params.size()>1) throw new UnclosedBracketsException();
                  
                  if(started && !parsingFinished)
                        throw new FatalErrorParsingException(LaTeXDrawLang.getString1_9("PSTricksParser.3")); //$NON-NLS-1$
                  
                  if(progressB!=null)
                        progressB.setValue(progressB.getMaximum());
                  
                  if(!parserMsgs.isEmpty())
                        ParserMessagesFrame.showParserMessagesFrame(parent, true, parserMsgs);
                  
                  return OK_PARSING;
                  
            }catch(FatalErrorParsingException e)
            {
                  String title = LaTeXDrawLang.getString1_6("PSTricksParser.3"); //$NON-NLS-1$
                  
                  if(parent!=null)
                        JOptionPane.showMessageDialog(parent, e.toString(), title, JOptionPane.ERROR_MESSAGE); 
                  else 
                        System.out.println(title+" "+e.toString()); //$NON-NLS-1$
                  
                  return ERROR_PARSING;
            }catch(Exception e)
            {
                  e.printStackTrace(); 
                  ExceptionFrameDialog.showExceptionDialog(e);
                  return ERROR_PARSING;
            }
      } //public int parse(String f, JFrame parent)


Generated by  Doxygen 1.6.0   Back to index