Package com.sun.j3d.loaders.objectfile

Source Code of com.sun.j3d.loaders.objectfile.ObjectFileParser

/*     */ package com.sun.j3d.loaders.objectfile;
/*     */
/*     */ import com.sun.j3d.loaders.ParsingErrorException;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ import java.io.Reader;
/*     */ import java.io.StreamTokenizer;
/*     */
/*     */ class ObjectFileParser extends StreamTokenizer
/*     */ {
/*     */   private static final char BACKSLASH = '\\';
/*     */
/*     */   void setup()
/*     */   {
/*  59 */     resetSyntax();
/*  60 */     eolIsSignificant(true);
/*  61 */     lowerCaseMode(true);
/*     */
/*  64 */     wordChars(33, 126);
/*     */
/*  67 */     commentChar(33);
/*     */
/*  69 */     whitespaceChars(32, 32);
/*  70 */     whitespaceChars(10, 10);
/*  71 */     whitespaceChars(13, 13);
/*  72 */     whitespaceChars(9, 9);
/*     */
/*  75 */     ordinaryChar(35);
/*  76 */     ordinaryChar(47);
/*  77 */     ordinaryChar(92);
/*     */   }
/*     */
/*     */   void getToken()
/*     */     throws ParsingErrorException
/*     */   {
/*  91 */     boolean done = false;
/*     */     try
/*     */     {
/*     */       do {
/*  95 */         int t = nextToken();
/*  96 */         if (t == 92) {
/*  97 */           t = nextToken();
/*  98 */           if (this.ttype != 10) done = true;
/*     */         } else { done = true; }
/* 100 */       }while (!done);
/*     */     }
/*     */     catch (IOException e) {
/* 103 */       throw new ParsingErrorException("IO error on line " + lineno() + ": " + e.getMessage());
/*     */     }
/*     */   }
/*     */
/*     */   void printToken()
/*     */   {
/* 112 */     switch (this.ttype) {
/*     */     case 10:
/* 114 */       System.out.println("Token EOL");
/* 115 */       break;
/*     */     case -1:
/* 117 */       System.out.println("Token EOF");
/* 118 */       break;
/*     */     case -3:
/* 120 */       System.out.println("Token TT_WORD: " + this.sval);
/* 121 */       break;
/*     */     case 47:
/* 123 */       System.out.println("Token /");
/* 124 */       break;
/*     */     case 92:
/* 126 */       System.out.println("Token \\");
/* 127 */       break;
/*     */     case 35:
/* 129 */       System.out.println("Token #");
/*     */     }
/*     */   }
/*     */
/*     */   void skipToNextLine()
/*     */     throws ParsingErrorException
/*     */   {
/* 143 */     while (this.ttype != 10)
/* 144 */       getToken();
/*     */   }
/*     */
/*     */   void getNumber()
/*     */     throws ParsingErrorException
/*     */   {
/*     */     try
/*     */     {
/* 162 */       getToken();
/* 163 */       if (this.ttype != -3)
/* 164 */         throw new ParsingErrorException("Expected number on line " + lineno());
/* 165 */       this.nval = Double.valueOf(this.sval).doubleValue();
/*     */     }
/*     */     catch (NumberFormatException e) {
/* 168 */       throw new ParsingErrorException(e.getMessage());
/*     */     }
/*     */   }
/*     */
/*     */   ObjectFileParser(Reader r)
/*     */   {
/* 178 */     super(r);
/* 179 */     setup();
/*     */   }
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\j3dutils.jar
* Qualified Name:     com.sun.j3d.loaders.objectfile.ObjectFileParser
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of com.sun.j3d.loaders.objectfile.ObjectFileParser

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.