Examples of TextFile


Examples of br.com.jteam.jfcm.model.TextFile

  @Override
  public File createFile(
      String name,
      String path)
  {
    return new TextFile(
        name,
        path);
  }
View Full Code Here

Examples of com.nexirius.util.TextFile

     */
    public void init(String stylefile)
            throws Exception {
        Style default_style = m_doc.addStyle(StyleContext.DEFAULT_STYLE, m_doc.getLogicalStyle(0));
        Style parent_style = default_style;
        TextFile file = new TextFile(stylefile);

        file.openForRead(file_id);

        TextToken token = file.nextToken();

        for (; token != null; token = file.nextToken()) {
            parent_style = default_style;
            String style_name = token.getString();

            if (token.isIdentifier()) {

                token = file.nextToken();

                if (token.isIdentifier("extends")) {
                    token = file.nextToken();

                    Style ps = m_doc.getStyle(token.getString());

                    if (ps != null) {
                        parent_style = ps;
                    }

                    token = file.nextToken();
                }

                Style new_style = m_doc.addStyle(style_name, parent_style);

                error("new style " + style_name);

                if (!token.isChar('{')) {
                    throw new Exception("Can't read style on line " + file.getActLine());
                }

                Attribute attr = readNextAttribute(file);

                // set the attributes
                for (; attr != null; attr = readNextAttribute(file)) {
                    attr.set(new_style);
                }
            } else {
                break;
            }
        }

        file.close();
    }
View Full Code Here

Examples of com.nexirius.util.TextFile

    /**
     * not yet supported!
     */
    public void writeTo(String stylefile)
            throws Exception {
        TextFile file = new TextFile(stylefile);

        if (file.exists()) {
            file.openExistingFileForWrite(file_id, file_version);
        } else {
            file.openNewFileForWrite(file_id, file_version);
        }

        file.close();
    }
View Full Code Here

Examples of dwlab.base.files.TextFile

  public int escapingBackslash = 0;
  private static String text;
         
  public static XMLObject readFromFile( String fileName ) {
    TextFile file = TextFile.read( fileName );
    text = "";

    version = 0;
    while( true ) {
      String string = file.readLine();
      if( string == null ) break;
      text += string;
      if( version == 0 ) {
        int quote = text.indexOf( "\"", text.indexOf( "dwlab_version" ) );
        version = Service.versionToInt( text.substring( quote + 1, text.indexOf( "\"", quote + 1 ) ) );
      }
    }

    file.close();

    textPos = 0;
    return readObject( new StringWrapper( "" ) );
  }
View Full Code Here

Examples of dwlab.base.files.TextFile

    return readObject( new StringWrapper( "" ) );
  }


  public void writeToFile( String fileName ) {
    TextFile file = TextFile.write( fileName );
    writeObject( file, "" );
    file.close();
  }
View Full Code Here

Examples of dwlab.base.files.TextFile

    this.fromNum = fromNum;
    this.toNum = toNum;
   
    if( variableLength ) {
      this.variableLength = variableLength;
      TextFile file = TextFile.read( fileName + "len" );
      this.letterWidth = new int[ symbolsQuantity ];
      while( true ) {
        String line = file.readLine();
        if( line == null ) break;
        letterWidth[ line.charAt( 0 ) - fromNum ] = Integer.parseInt( line.substring( 2 ) );
      }
    }
 
View Full Code Here

Examples of flex2.compiler.io.TextFile

            //  TODO ideally, we could just convert this in-place to a ClassNode for downstream processing
            //  Good example of why an explicit type descriptor enum is generally more useful than subclassing
            node.setClassQName(classQName);

            // Create a new Source for the node.
            VirtualFile virtualFile = new TextFile("", unit.getSource().getName() + "$" + className,
                                                   unit.getSource().getName(), unit.getSource().getParent(),
                                                   MimeMappings.MXML, unit.getSource().getLastModified());
            Source source = new Source(virtualFile, unit.getSource(), className, false, false);

            // Set the Source's syntax tree to the DocumentNode
View Full Code Here

Examples of flex2.compiler.io.TextFile

            // TODO ideally, we could just convert this in-place to a ClassNode for downstream processing
            // Good example of why an explicit type descriptor enum is generally more useful than subclassing
            node.setName(classQName);

            // Create a new Source for the node.
            VirtualFile virtualFile = new TextFile("", unit.getSource().getName() + "$" + className,
                                                   unit.getSource().getName(), unit.getSource().getParent(),
                                                  MimeMappings.MXML, unit.getSource().getLastModified());
            Source source = new Source(virtualFile, unit.getSource(), className, false, false);

            // Set the Source's syntax tree to the DocumentNode
View Full Code Here

Examples of flex2.compiler.io.TextFile

          }
          else
          {
            // use Source.getName() to construct the new VirtualFile name
            String n = source.getName().replace('\\', '/') + ":" + script.getXmlLineNumber() + "," + script.getEndXmlLineNumber();
            VirtualFile f = new TextFile(script.getText(), n, source.getParent(), MimeMappings.AS, source.getLastModified());

                        // line number map is for error reporting, so the names must come from error reporting...
                        LineNumberMap m = new LineNumberMap(source.getNameForReporting(), n);

                        m.put(script.getXmlLineNumber(), 1, (script.getEndXmlLineNumber() - script.getXmlLineNumber()));
                        // C: add this so that when unexpected EOF occurs, (last line + 1) maps to the last line
                        //    in the original XML Script block.
                        m.put(script.getEndXmlLineNumber(), script.getEndXmlLineNumber() - script.getXmlLineNumber() + 1, 1);

                        // 'n' must match 'n' in the include directive...
                        source.addSourceFragment(n, f, m);

                        // 'n' must match 'n' in the addSourceFragment call.
                        scriptSet.add(new SourceCode("include \"" + n + "\";", script.getXmlLineNumber(), out, map));
                    }
                }

                //  create SourceCode wrappers for metadata entries
                Set<SourceCode> metadataSet = new LinkedHashSet<SourceCode>();
                for (Iterator iter = info.getMetadata().iterator(); iter.hasNext(); )
                {
                    Script script = (Script)iter.next();
                    metadataSet.add(new SourceCode(script.getText(), script.getXmlLineNumber(), out, map));
                }

                //  create SourceCode wrappers for variable declarations
                Map<String, SourceCode> varDeclMap = new LinkedHashMap<String, SourceCode>();
                for (Iterator iter = info.getVarDecls().values().iterator(); iter.hasNext(); )
                {
                    DocumentInfo.VarDecl varDecl = (DocumentInfo.VarDecl)iter.next();
                    varDeclMap.put(varDecl.name, new SourceCode(varDecl.className, varDecl.line, out, map));
                }

                int superClassLineNumber = 1;

                Set<SourceCode> importNameSet = new LinkedHashSet<SourceCode>();
                for (Iterator i = info.getImportNames().iterator(); i.hasNext();)
                {
                    DocumentInfo.NameInfo importName = (DocumentInfo.NameInfo) i.next();
                    importNameSet.add(new SourceCode(importName.getName(), importName.getLine(), out, map));

                    if (importName.getName().equals(info.getQualifiedSuperClassName()))
                    {
                        superClassLineNumber = importName.getLine();
                    }
                }
                for (Iterator<String> i = bogusImports.iterator(); i.hasNext();)
                {
                    String importName = i.next();
                    importNameSet.add(new SourceCode(importName, 1, out, map));
                }

                Set<SourceCode> interfaceNameSet = new LinkedHashSet<SourceCode>();
                for (Iterator i = info.getInterfaceNames().iterator(); i.hasNext();)
                {
                    DocumentInfo.NameInfo interfaceName = (DocumentInfo.NameInfo) i.next();
                    interfaceNameSet.add(new SourceCode(interfaceName.getName(), interfaceName.getLine(), out, map));
                }

                // register values
                velocityContext.put("imports", importNameSet);
                velocityContext.put("variables", varDeclMap.entrySet());
                velocityContext.put("scripts", scriptSet);
                velocityContext.put("classMetaData", metadataSet);
                velocityContext.put("bindingManagementVariables", FrameworkDefs.bindingManagementVars);

                // C: should really give line number mappings to superclass name and interface names.
                velocityContext.put("superClassName", new SourceCode(info.getQualifiedSuperClassName(), superClassLineNumber, out, map));
                velocityContext.put("interfaceNames", interfaceNameSet);

                velocityContext.put("className", info.getClassName());
                velocityContext.put("packageName", info.getPackageName());

                // run the template!
                //long s2 = System.currentTimeMillis();
                //VelocityManager.parseTime += s2 - start;
                template.merge(velocityContext, out);
                //VelocityManager.mergeTime += System.currentTimeMillis() - s2;

                // Normalize line endings as a temporary work around for bug 149821
                String generated = out.toString().replaceAll("\r\n", "\n");
                String filename = writeGenerated(info, generated);
         TextFile textFile = new TextFile(generated, filename, source.getParent(),
                          MimeMappings.AS, source.getLastModified());
         return new Source(textFile, source);
            }
            catch (ResourceNotFoundException ex)
            {
View Full Code Here

Examples of flex2.compiler.io.TextFile

  private Source generateSkeletonAST(DocumentInfo info, Set<String> bogusImports,
                     Source source, SymbolTable symbolTable)
  {
    String fileName = MxmlCompiler.getGeneratedName(mxmlConfiguration, info.getPackageName(),
                            info.getClassName(), "-interface.as");
    TextFile textFile = new TextFile(EMPTY_STRING, fileName, source.getName(), source.getParent(),
                     MimeMappings.MXML, source.getLastModified());

    Source result = new Source(textFile, source);

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