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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rcmainframe.java

?? 外國人寫的c#語法解析器
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产网站一区二区| 欧美日韩一区三区四区| 久久只精品国产| 日日夜夜免费精品视频| 色偷偷久久一区二区三区| 国产精品久久久久aaaa| 成人中文字幕合集| 国产精品青草久久| 成人一区二区三区在线观看| 欧美日韩夫妻久久| 丝袜美腿高跟呻吟高潮一区| 欧美日韩高清影院| 日本午夜精品一区二区三区电影 | 欧美剧在线免费观看网站| 欧美国产日韩a欧美在线观看 | 亚洲欧美日韩一区| 99精品视频一区二区三区| 亚洲桃色在线一区| 在线视频你懂得一区| 亚洲成人三级小说| 日韩午夜在线影院| 国产精品一区三区| 国产精品福利一区| 欧亚一区二区三区| 亚洲a一区二区| 91精品国产麻豆国产自产在线 | 国产午夜精品久久久久久免费视| 国产大陆精品国产| 亚洲精品久久7777| 成人av电影在线| 国产精品国产三级国产aⅴ中文| 不卡视频在线看| 亚洲一区二区三区四区不卡 | 在线观看成人小视频| 午夜伦欧美伦电影理论片| 日韩欧美国产综合一区| 国产69精品久久99不卡| 亚洲国产毛片aaaaa无费看| 51午夜精品国产| 久久99久久久久| 国产精品久久二区二区| 欧美在线小视频| 国产一区二区h| 一区二区三区精品| 欧美tickling挠脚心丨vk| 波多野结衣的一区二区三区| 香蕉成人伊视频在线观看| 欧美成人在线直播| 国产精品99久久久久久久vr| 一区二区三区四区亚洲| 精品久久免费看| 色屁屁一区二区| 国产麻豆日韩欧美久久| 亚洲第四色夜色| 亚洲欧美影音先锋| 91精品久久久久久久久99蜜臂 | 一个色在线综合| 久久久久久9999| 欧美精品黑人性xxxx| av一本久道久久综合久久鬼色| 丝袜a∨在线一区二区三区不卡| 国产日韩欧美精品一区| 色婷婷亚洲婷婷| 成人免费视频免费观看| 免费高清不卡av| 午夜亚洲福利老司机| 中文字幕在线不卡一区| 精品不卡在线视频| 精品99一区二区三区| 欧美色精品在线视频| 国产黄色精品网站| 国产精品白丝av| 久久国产福利国产秒拍| 一区二区三区四区亚洲| 国产成人免费视频网站高清观看视频 | 亚洲成人免费在线| 亚洲日本成人在线观看| 精品sm在线观看| 欧美不卡在线视频| 欧美一区二区私人影院日本| 91色porny蝌蚪| 欧美亚洲一区三区| 色激情天天射综合网| 成人97人人超碰人人99| 91浏览器在线视频| 99国产麻豆精品| 久久99深爱久久99精品| 国产精品一区专区| 国产精品综合二区| 国产不卡视频在线播放| 国产成人精品aa毛片| 国产美女精品一区二区三区| 国产激情视频一区二区在线观看| 久久国产免费看| 国产自产高清不卡| 成人免费看片app下载| 成人黄色777网| 91在线观看一区二区| 日本高清无吗v一区| 欧美专区日韩专区| 在线成人免费视频| 成人av片在线观看| 成人晚上爱看视频| av电影在线观看不卡| 91蜜桃视频在线| 91福利视频久久久久| 欧美亚洲自拍偷拍| 欧美精品xxxxbbbb| 精品国产一区二区三区忘忧草 | 亚洲午夜一区二区| 午夜国产不卡在线观看视频| 亚洲成av人片在线观看无码| 日韩福利视频网| 紧缚捆绑精品一区二区| 国产成人亚洲综合a∨婷婷 | 国产性色一区二区| 国产精品久久久久久久久免费相片 | 中文字幕一区二区三| 亚洲美腿欧美偷拍| 亚洲综合一区在线| 亚洲小少妇裸体bbw| 日韩av不卡在线观看| 日韩中文字幕91| 成人av在线资源| 精品视频123区在线观看| 日韩欧美一二三四区| 国产欧美1区2区3区| 亚洲午夜激情av| 麻豆国产一区二区| 99视频一区二区| 日韩欧美的一区二区| 久久免费视频色| 亚洲自拍偷拍麻豆| 国产在线观看一区二区| 精品国产乱码久久久久久久| 国产精品成人免费| 日韩综合一区二区| 成人短视频下载| 欧美一卡二卡在线观看| 一卡二卡欧美日韩| 国产成人免费在线观看不卡| 欧美日精品一区视频| 精品对白一区国产伦| 一个色妞综合视频在线观看| 国内精品伊人久久久久av一坑| 91免费视频网| 日韩午夜精品电影| 亚洲国产精品久久一线不卡| 成人性生交大片免费| 99国产麻豆精品| 久久久亚洲精华液精华液精华液| 最新日韩在线视频| 国产成人av电影在线观看| 欧美乱熟臀69xxxxxx| 亚洲精品免费视频| 成人激情文学综合网| 日韩精品一区二区三区蜜臀| 蜜桃av噜噜一区| 欧美揉bbbbb揉bbbbb| 国产精品电影一区二区| 国产精品一区免费在线观看| 3d动漫精品啪啪| 亚洲福利一区二区三区| 91伊人久久大香线蕉| 国产日本欧美一区二区| 免费在线观看不卡| 欧美日韩国产影片| 亚洲精品免费电影| 91香蕉视频mp4| 国产精品嫩草99a| 粉嫩久久99精品久久久久久夜| 日韩欧美一级片| 男女性色大片免费观看一区二区| 欧美影院精品一区| 一区二区三区欧美亚洲| 91在线观看高清| 成人欧美一区二区三区小说| 国产 日韩 欧美大片| 亚洲同性同志一二三专区| 色呦呦网站一区| 日日摸夜夜添夜夜添国产精品| 日韩精品一区二区三区四区| 国产激情91久久精品导航| 中文字幕一区二区三| 欧美色网站导航| 久久99国产精品免费网站| 国产日韩精品一区二区浪潮av | 欧美午夜电影一区| 日韩和欧美的一区| 久久精品在这里| 91亚洲精品一区二区乱码| 亚洲午夜羞羞片| 精品久久久久久无| 99久久er热在这里只有精品15| 亚洲美女电影在线| 日韩欧美一卡二卡| 91热门视频在线观看| 日韩成人一区二区| 欧美国产综合色视频| 欧美无砖专区一中文字|