亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? rcmainframe.java

?? 外國(guó)人寫(xiě)的c#語(yǔ)法解析器
?? JAVA
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
package net.softgems.resourceparser;

import java.io.*;
import java.util.ArrayList;

import net.softgems.resourceparser.main.*;
import net.softgems.resourceparser.preprocessor.*;
import net.softgems.resourceparser.xml.ResourceStatement;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Text;
import org.jdom.*;
import org.jdom.output.*;

import antlr.TokenStreamRecognitionException;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.graphics.Font;
import antlr.collections.AST;

/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a
* for-profit company or business) then you should purchase
* a license - please visit www.cloudgarden.com for details.
*/
public class RCMainFrame extends org.eclipse.swt.widgets.Composite {
	private Button browseOutputFolderButton;
	private Text outputPathEdit;
	private Label button1;
	private Button browseIniFileButton;
	private Text txtFileNameEdit;
	private Button multipleFilesRadioButton;
	private Button browseRCFileButton;
	private Text rcFileNameEdit;
	private Button singleFileRadioButton;
	private Composite composite7;
	private Button addIncludePathButton;
	private Button addSymbolButton;
  private String[] commandLine;
	private Composite composite1;
	private Composite composite2;
	private Composite composite3;
	private Composite composite4;
	private Composite composite5;
	private Composite composite6;
  private ArrayList defines = new ArrayList();
	private Group group1;
	private List includePathList;
  private ArrayList includes = new ArrayList();
	private Label label2;
	private Label label3;
	private Label label4;
	private Label label5;
	private Label label6;
	private Label label7;
	private Button parseButton;
	private Button removeIncludePathButton;
	private Button removeSymbolButton;
	private Shell shell;
	private TabFolder tabFolder1;
	private TabItem tabItem1;
	private TabItem tabItem2;
	private TabItem tabItem3;
	private TableColumn tableColumn1;
	private TableColumn tableColumn2;
  protected TableCursor cursor;
	protected int errorCount;
  protected boolean isEditing;
	protected List log;
	protected Label parseLineLabel;
	protected Tree parseTree;
  protected int preProcessedLines;
	protected Label preprocessLineLabel;
	protected List processedIncludesList;
	protected int processedLines;
	protected Table symbolsTable;
	protected int tokenCount;
  
  /** Mapper to convert a parse event into a textual representation. */
  protected String[] eventStrings = new String[] {
    "(PANIC) ", "(Error) ", "(Warning) ", "(Information) "
  };
  
	public RCMainFrame(Composite parent, int style, String[] args) {
		super(parent, style);
		this.shell = (Shell) parent;
    commandLine = args;
		initGUI();
	}
  
  //------------------------------------------------------------------------------------------------

  /**
   * Converts the given file, which must be an rc file to XML.
   * 
   * @param file The file to convert.
   * @param writeIntermediate If <b>true</b> then the intermediate text that comes out from the
   *         preprocessing step is written in a separate file with extension *.rcX. Since this
   *         intermediate content is the base for the parser all error line numbers correspond to
   *         this file, not the original input.
   * @param createVisualAST If <b>true</b> then the abstract syntax tree is loaded into a treeviewer
   *         for examination. This step is not needed for the conversion process.
   * @param targetPath The path where to write the resulting XML file to. If this path is <b>null</b>
   *         then the XML file is written to the folder where the source file is located.
   * @return <b>true</b> if no error/warning was reported, otherwise <b>false</b>.
   * @throws Exception Thrown for various reasons (IO error, recognition error etc.).
   */
  private boolean convertFile(String filename, boolean writeIntermediate, boolean createVisualAST,
    String targetPath) throws Exception
  {
    boolean result = true;
    
    File file = new File(filename);
    logMessage("Parsing file: " + file.getCanonicalPath());
    
    // Set the current user directory to be the folder that contains the current rc file.
    // This is necessary to make inclusion of file with relative path possible.
    String folder = file.getParent();
    System.setProperty("user.dir", folder);
    logMessage("Set working folder to " + folder);
    
    // The translation of a resource file is done very similar to the phases described in MSDN:
    // "C/C++ Preprocessor Reference" -> "Phases of Translation".
    // Note: None of the steps described below is done on its own. It is rather a big chain
    //       driven by the parser, which reads tokens from the lexer, which reads characters from
    //       the preprocessor, which reads lines from the input converter, which reads raw bytes.
    
    PreprocessorInputState inputState = new PreprocessorInputState();

    // 1) Convert the input data into our internal representation (Unicode). 
    //    Convert trigraph sequences and do line splicing in this process too.
    //    For conversion it is necessary to know in which character set the input is encoded.
    //    Standard C files are all ANSI (ISO-8859-1, Latin-1) encoded, but resource files may have
    //    any other encoding including Unicode, so it is important to specify the right encoding.
    //    However usually also resource files are ANSI encoded, hence this charset can be used as 
    //    a good first guess. Resource files may contain a #pragma code_page directive to switch
    //    the current codepage.
    InputConverter converter = new InputConverter(inputState, new FileInputStream(filename), 
      Preprocessor.DEFAULT_CHARSET);
    
    // 2) Handle preprocessor directives.
    //    The preprocessor takes a list of include pathes and a list of predefined symbols.
    //    Output will be cleaned source code without any preprocessor stuff and without comments.
    //    Include files will directly be imported by the preprocessor.
    Preprocessor preprocessor = new Preprocessor(converter, null, inputState, false);
    for (int i = 0; i < includePathList.getItemCount(); i++)
      preprocessor.addIncludePath(includePathList.getItem(i));
    
    for (int i = 0; i < symbolsTable.getItemCount(); i++)
    {
      TableItem item = symbolsTable.getItem(i);
      preprocessor.addMacro(item.getText(0) + ' ' + item.getText(1));
    }
    
    preprocessor.addPreprocessorEventListener(
      new IParseEventListener() 
      {
        public void handleEvent(int event, String message)
        {
          switch (event)
          {
            case IParseEventListener.NEW_LINE:
            {
              preProcessedLines++;
              if (preProcessedLines % 5000 == 0)
              {
                preprocessLineLabel.setText(Integer.toString(preProcessedLines));
                preprocessLineLabel.update();
              }
              break;
            }
            case IParseEventListener.INCLUDE_FILE:
              processedIncludesList.add(message);
              processedIncludesList.update();
              break;
            default:
              log.add("[Preprocessor] " + eventStrings[event] + message);
              log.update();
          };
        };
      }
    );
    
    // 3) Tokenize the input and feed the parser.
    inputState.pushState(preprocessor, file.getName(), file.getParent());

    // Once the initial state is set we can add extra files we need to be parsed in advance.
    // Using Winresrc.h as standard include will make sure everything else, which is usually
    // included by the resource compiler is also included here.
    preprocessor.includeFile("Winresrc.h");
    
    RCLexer lexer = new RCLexer(inputState);
    lexer.addLexerEventListener(
      new IParseEventListener()
      {
        public void handleEvent(int event, String message)
        {
          switch (event)
          {
            case IParseEventListener.NEW_LINE:
            {
              processedLines++;
              parseLineLabel.setText("" + processedLines);
              parseLineLabel.update();
              
              break;
            }
            default:
            {
              log.add("[Lexer] " + eventStrings[event] + message);
              log.update();
            }
          };
        };
      }
    );

    // 4) Here comes the actual parsing. This step converts the rc source code into an
    //    abstract syntax tree (AST).
    RCParserSharedInputState parserInputState = new RCParserSharedInputState();
    parserInputState.setInput(lexer);
    RCParser parser = new RCParser(parserInputState);
    parser.setFilename(filename);
    parser.addParserEventListener(
      new IParseEventListener() 
      {
        public void handleEvent(int event, String message)
        {
          log.add("[Parser] " + eventStrings[event] + message);
          log.update();
        };
      }
    );

    // This call will actually start the parsing process.
    parser.resource_definition();
    if (preprocessor.hadErrors() || lexer.hadErrors() || parser.hadErrors())
      result = false;
    
    logMessage("Parsing finished.");
    
    if (createVisualAST)
    {
      logMessage("Filling abstract syntax tree.");
      fillParseTree(parser);
    }
    
    // Finally write out the XML data.
    exportXML(parser, file, preprocessor.getMacroTable(), targetPath);
    
    // Free unused objects in case there is a large bunch of files to convert.
    System.gc();
    
    return result;
  }

  //------------------------------------------------------------------------------------------------

  /**
   * Exports all parsed content to an XML file named like the input file but with xml extension.
   * 
   * @param parser The parser containing the parsed data.
   * @param sourceFile The input file (only need to create the target file name from).
   * @param macroTable The macro class that allows to resolve expressions.
   * @param targetPath The path where to write the resulting XML file to. If this path is <b>null</b>
   *         then the XML file is written to the folder where the source file is located.
   */
  private void exportXML(RCParser parser, File sourceFile, MacroTable macroTable, String targetPath)
  {
    String filename;
    try
    {
      filename = sourceFile.getName();
      int index = filename.lastIndexOf('.');
      if (index == -1)
        filename += ".xml";
      else
        filename = filename.substring(0, index) + ".xml";

      File targetFile;
      if (targetPath == null)
      {
        targetPath = sourceFile.getParent();
      }
      if (!targetPath.endsWith("\\") && !targetPath.endsWith("/"))
        targetPath += "/";
      targetFile = new File(targetPath + filename);
      if (targetFile.exists())
        targetFile.delete();
      if (targetFile.createNewFile())
      {
        logMessage("Exporting result to " + filename);
        
        Document document = new Document();
        Element rootElement = new Element("dialog-definition");
        document.setRootElement(rootElement);
        
        AST node = parser.getAST();
        while (node != null)
        {
          ResourceStatement statement = new ResourceStatement(this, node);
          statement.setMacroTable(macroTable);
          statement.convert(rootElement);
          node = node.getNextSibling();
        }
       
        // Let JDOM format the output and write the result to disc.
        Format format = Format.getPrettyFormat();
        XMLOutputter outputter = new XMLOutputter(format);
        OutputStream stream = new FileOutputStream(targetFile);
        outputter.output(document, stream);
        stream.close();
      }
      else
      {
        logMessage("Could not create target file " + filename);
      }
    }
    catch (IOException e)
    {
      logMessage("Error while creating output file " + sourceFile.getAbsolutePath());
    }
  }

  //------------------------------------------------------------------------------------------------

  private void fillParseTree(RCParser parser)
  {
    parseTree.removeAll();
    AST root = parser.getAST();
    while (root != null)
    {
      TreeItem item = new TreeItem(parseTree, SWT.NULL);
      item.setText(root.getText() + " (" + parser.getTokenName(root.getType()) + ")");
      fillParseTreeNode(parser, root, item);
      
      root = root.getNextSibling();
    }
  }

  //------------------------------------------------------------------------------------------------

  private void fillParseTreeNode(RCParser parser, AST astNode, TreeItem treeNode)
  {
    AST run = astNode.getFirstChild();
    while (run != null)
    {
      TreeItem item = new TreeItem(treeNode, SWT.NULL);
      item.setText(run.getText() + " (" + parser.getTokenName(run.getType()) + ")");
      fillParseTreeNode(parser, run, item);
      
      run = run.getNextSibling();
    }
  }
	
  //------------------------------------------------------------------------------------------------
  
  /**
   * Checks the java command line for include path and symbol specifications. We accept two entry 
   * types. One is 
   *   -include=path 
   * and the other is

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久噜噜亚洲综合| www国产精品av| 狠狠色2019综合网| 国产精品久久久久影院色老大| 91在线码无精品| 蜜桃视频一区二区三区在线观看| 国产日韩精品久久久| 欧美性一二三区| 高清国产一区二区三区| 三级久久三级久久久| 欧美高清在线一区| 日韩一级高清毛片| 色吊一区二区三区| 国产精品99久久久久久宅男| 午夜欧美在线一二页| 国产精品视频观看| 欧美精品一区二区三区一线天视频| 在线观看免费视频综合| 国产精品亚洲第一区在线暖暖韩国| 亚洲国产精品麻豆| 亚洲色图欧美激情| 中文字幕乱码久久午夜不卡| 日韩三级视频在线观看| 欧洲精品在线观看| 国产**成人网毛片九色| 久久精品国产99国产| 亚洲国产日韩a在线播放| 国产精品乱码一区二三区小蝌蚪| 日韩欧美国产电影| 欧美日韩免费观看一区二区三区| 99久久婷婷国产精品综合| 国产精品亚洲成人| 激情综合色综合久久综合| 丝袜美腿亚洲色图| 亚洲一区自拍偷拍| 亚洲视频小说图片| 日韩一区中文字幕| 欧美激情资源网| 久久久av毛片精品| 精品人在线二区三区| 欧美一区二区在线播放| 欧美日韩国产小视频| 91行情网站电视在线观看高清版| 99免费精品在线观看| 成人免费va视频| 国产成人av一区| 国产精品99久久久| 国产激情一区二区三区| 国产精品一卡二卡| 国产黑丝在线一区二区三区| 国产激情视频一区二区在线观看| 韩国成人精品a∨在线观看| 蜜臀av一区二区| 蜜桃av一区二区三区| 日韩电影网1区2区| 日本成人中文字幕| 毛片基地黄久久久久久天堂| 免费成人在线视频观看| 麻豆国产精品777777在线| 日韩精品一二三| 久久精品国产精品亚洲精品 | 国产激情偷乱视频一区二区三区| 激情都市一区二区| 国产精一区二区三区| 国产凹凸在线观看一区二区| 国产成人自拍网| 北岛玲一区二区三区四区| 一本久久a久久精品亚洲| 在线观看日韩电影| 欧美一区二区三区四区视频 | 亚洲国产一区视频| 亚洲一二三四在线| 日韩不卡一区二区| 精品一区二区三区免费观看 | 欧美精品一区二区三区蜜臀| 久久蜜桃一区二区| 成人欧美一区二区三区黑人麻豆| 伊人性伊人情综合网| 午夜精品久久久久久不卡8050| 免费成人在线影院| 成人免费精品视频| 欧美日本一道本在线视频| 欧美成人精品1314www| 国产欧美一区二区精品性色| 亚洲欧美日韩系列| 天天操天天干天天综合网| 国内精品不卡在线| 91色九色蝌蚪| 精品国免费一区二区三区| 中文无字幕一区二区三区| 依依成人综合视频| 久久99九九99精品| 91蜜桃在线观看| 精品国产乱子伦一区| 日韩久久一区二区| 麻豆精品久久精品色综合| 成人avav在线| 欧美精品 日韩| 日本一区二区久久| 午夜婷婷国产麻豆精品| 国产高清不卡一区| 欧美色窝79yyyycom| 国产色爱av资源综合区| 亚洲成人av资源| 国产99精品视频| 欧美另类久久久品| 国产拍欧美日韩视频二区| 偷窥少妇高潮呻吟av久久免费| 美女免费视频一区二区| 成年人网站91| 日韩欧美国产一区在线观看| 自拍偷拍欧美精品| 另类人妖一区二区av| 色综合激情五月| 久久人人爽爽爽人久久久| 亚洲电影欧美电影有声小说| 不卡一二三区首页| 日韩免费一区二区| 亚洲一区av在线| 99久久亚洲一区二区三区青草| 精品电影一区二区| 日本视频在线一区| 在线一区二区三区四区五区| 国产日韩欧美精品一区| 日本中文字幕一区二区视频 | 欧美二区三区的天堂| 国产精品私人自拍| 狠狠色伊人亚洲综合成人| 欧美日韩在线亚洲一区蜜芽| 国产精品国产三级国产| 国产很黄免费观看久久| 欧美成va人片在线观看| 日韩影院免费视频| 欧美体内she精视频| 国产精品进线69影院| 国产乱子伦视频一区二区三区| 51精品视频一区二区三区| 亚洲自拍欧美精品| 色综合天天天天做夜夜夜夜做| 欧美国产精品中文字幕| 国产久卡久卡久卡久卡视频精品| 日韩午夜在线影院| 日韩黄色一级片| 欧美色图天堂网| 一区二区不卡在线播放| 色悠久久久久综合欧美99| 国产精品久久久久一区| 国产成a人亚洲| 国产色综合久久| 国产做a爰片久久毛片| 日韩三级电影网址| 蜜臀国产一区二区三区在线播放| 欧美精品免费视频| 日韩一区欧美二区| 欧美一区二区三区白人| 日本欧洲一区二区| 日韩欧美一级片| 精彩视频一区二区三区| 久久亚洲欧美国产精品乐播| 国产一区在线精品| 国产日韩视频一区二区三区| 丰满亚洲少妇av| 国产精品色一区二区三区| 成人av网站在线| 亚洲精品乱码久久久久久黑人 | 欧美精品一区二区三区在线播放| 国产一区二区0| 亚洲国产高清aⅴ视频| 91在线看国产| 亚洲一区二区三区四区在线免费观看| 日本精品一区二区三区四区的功能| 亚洲精品成人少妇| 欧美女孩性生活视频| 美女网站色91| 久久久久久久久久久久久久久99| 国产成人综合视频| 亚洲免费av网站| 欧美美女喷水视频| 国产一区二区精品久久91| 中文字幕在线观看不卡| 欧美在线一区二区| 蜜臂av日日欢夜夜爽一区| 精品一区免费av| 亚洲国产精华液网站w| 欧美色网一区二区| 狠狠色丁香久久婷婷综合_中| 国产精品天天摸av网| 精品视频资源站| 精品在线播放免费| 亚洲猫色日本管| 777a∨成人精品桃花网| 国产乱人伦偷精品视频不卡| 亚洲欧美欧美一区二区三区| 在线不卡一区二区| 国产美女精品一区二区三区| 亚洲欧洲日产国码二区| 欧美精品99久久久**| 国产成人欧美日韩在线电影| 亚洲美女视频在线观看| 日韩久久精品一区|