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

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

?? macrotable.java

?? 外國人寫的c#語法解析器
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
    for (int i = 0; i < listeners.size(); i++)
    {
      IParseEventListener listener = (IParseEventListener)listeners.get(i);
      listener.handleEvent(event, message);
    }
  }
  
  //------------------------------------------------------------------------------------------------

  /**
   * Substitutes the given macro definition (which might simply be an identifier without any 
   * associated value) and returns the substitution string for it.
   * The method does not raise an exception or show an error otherwise. The caller is responsible
   * to take the appropriate action when null is returned.
   * 
   * @param macroName A macro call or simple identifier to be replaced.
   * @param parameters A list of parameters, if <b>macro</b> refers to a macro call (can be null).
   * @return A string containing the textual replacement for the input or null if
   *          there is no replacement.
   */
  protected String getMacroSubstitution(String macroName, String[] parameters)
  {
    String result = null;
    
    Macro macro = (Macro) macros.get(macroName);
    if (macro != null)
      result = macro.getSubstition(parameters);
    
    return result;
  }

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

  /**
   * Adds the given event listener to the internal listener list.
   * 
   * @param listener The listener to add.
   */
  public void addMacroEventListener(IParseEventListener listener)
  {
    listeners.add(listener);
  }

  //----------------------------------------------------------------------------------------------
  
  /**
   * Adds the given macro definition to the table. Such a definition must consist solely of
   * an identifier and an optional replacement text separated by one or more white spaces (space, tab).
   * Additionally, as with C/C++, the macro identifier might be followed by a parameter list 
   * enclosed in parenthesis, similar to a function call.
   * 
   * @param definition The macro definition to parse.
   * @throws A runtime exception is thrown if the definition contains errors.
   */
  public void defineMacro(String definition)
  {
    if (definition.trim().length() != 0)
    {
      // Split the definition into the main parts. 
      // Note: If the macro contains parentheses then there must be no white space between the
      //       macro identifier and the parameter list. This is necessary to distinct between a 
      //       function macro and a symbolic constant enclosed in parentheses.
      String[] parts = null; 
      Macro macro = null;
      MacroTokenizer tokenizer = new MacroTokenizer(definition, false);
      
      // Skip to the first identifier.
      int token;
      do
      {
        token = tokenizer.nextToken();
      }
      while (token != StreamTokenizer.TT_WORD);
      String macroName = tokenizer.getStringValue();
      token = tokenizer.nextToken();
      if (token == '(')
      {
        // Found a macro call.
        String parameters = tokenizer.getInnerText();
        String[] parameterList = parameters.split(",");
        for (int i = 0; i < parameterList.length; i++)
          parameterList[i] = parameterList[i].trim();
        String substitution = tokenizer.getRawInput(Integer.MAX_VALUE);
  
        // Check if the macro is already defined with another value.
        macro = (Macro) macros.get(macroName);
        if (macro != null)
        {
          if (!macro.substitution.equals(substitution))
            reportWarning("Macro " + macroName + " is being redefined.");
        }
        else
          macro = new Macro(macroName, parameterList, substitution.trim());
      }
      else
      {
        // We are dealing with a simple macro definition (a.k.a macro object).
        parts = definition.trim().split(" |\t", 2);
        String substitution = null;
        if (parts.length == 0)
          reportError("Empty macro definition found.");
        else
          if (parts.length > 1)
            substitution = parts[1].trim();
        macroName = parts[0].trim();
        
        // Check if the macro is already defined with another value.
        macro = (Macro) macros.get(macroName);
        if (macro != null)
        {
          if ((macro.substitution == null) != (substitution == null)) 
            reportWarning("Macro " + macroName + " is being redefined.");
          else
            if (macro.substitution != null && !macro.substitution.equals(substitution))
              reportWarning("Macro " + macroName + " is being redefined.");
        }
        else
          macro = new Macro(macroName, null, substitution);
      }
      macros.put(macroName, macro);
    }
  }

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

  /**
   * Takes the input string and scans it for macro identifiers. Each occurence is recursively expanded.
   */
  public String expandMacros(String input)
  {
    if (input == null)
      return null;
    else
    {
      String expandedString = "";
      if (input.length() > 0)
      {
        StringBuffer buffer = new StringBuffer();
        MacroTokenizer tokenizer = new MacroTokenizer(input, false);
        boolean endReached = false;
        while (!endReached)
        {
          int token = tokenizer.nextToken();
          switch (token)
          {
            case StreamTokenizer.TT_EOF:
            {
              endReached = true;
              break;
            }
            case StreamTokenizer.TT_WORD:
            {
              String symbol = tokenizer.getStringValue();
              
              // Identifier found, which means that's something we have to expand or it is a
              // preprocessor directive. Could well be a normal identifier, though.
              if (!symbol.equals("defined") && (!isDefined(symbol) || evaluationList.contains(symbol)))
              {
                // If there is no known macro definition then keep the name without scanning
                // further. If the symbol is already being expanded then we found an endless
                // recursion. In this case the symbol also can be added to the output as it
                // will then be catched by the evaluator as an undefined symbol.
                // This is the same behavior like that of MSVC.
                buffer.append(symbol);
              }
              else
              {
                // Make sure we do not get into an endless definition loop.
                evaluationList.add(symbol);
                // Note: The tokenizer is prepared so that number signs (#) belong to identifiers.
                //       In valid rc and header files number signs can only appear as part of a
                //       preprocessor directive, which is never macro-expanded.
                if (symbol.charAt(0) == '#')
                {
                  buffer.append(symbol);
                  break;
                }
                // Check if the identifier is followed by a parenthesis as this is
                // then a list of parameters and separates a macro symbol from a macro call.
                // Note: We are now going to directly manipulate the underlying reader of our tokenizer,
                //       so everything we consume here is never seen by the tokenizer.
                int localToken = tokenizer.nextToken();
                
                // Skip any whitespace but note if there were some and output a single space for them.
                boolean outputWhiteSpace = false;
                while (localToken == ' ' || localToken == '\t')
                {
                  outputWhiteSpace = true;
                  localToken = tokenizer.nextToken();
                }
                if (localToken == '(')
                {
                  if (symbol.equals("defined"))
                  {
                    // Special case: "defined(symbol)".
                    localToken = tokenizer.nextToken();
                    if (localToken != StreamTokenizer.TT_WORD)
                      reportError("Invalid macro definition");
                    symbol = tokenizer.getStringValue();
                    localToken = tokenizer.nextToken();
                    if (localToken != ')')
                      reportError("Invalid macro definition");
                    if (isDefined(symbol))
                      buffer.append("true");
                    else
                      buffer.append("false");
                    
                    break;
                  }
                    
                  String[] parameters = null;
                  // Collect all actual parameters into a list of strings and use this to 
                  // resolve the macro call.
                  String paramList = tokenizer.getInnerText();
                  if (paramList == null)
                    parameters = null;
                  else
                    parameters = paramList.split(",");
                  
                  // Recurse here for nested macro definitions.
                  String substitution = expandMacros(getMacroSubstitution(symbol, parameters));
                  if (substitution != null)
                    buffer.append(substitution);
                }
                else
                {
                  tokenizer.pushBack();
                  
                  // Just a simple macro symbol.
                  String substitution = expandMacros(getMacroSubstitution(symbol, null));
                  if (substitution != null)
                    buffer.append(substitution);
                  
                  if (outputWhiteSpace)
                    buffer.append(" ");
                }
                evaluationList.remove(symbol);
             }
              break;
            }
            case '"':
            {
              buffer.append('"');
              buffer.append(tokenizer.getStringValue());
              buffer.append('"');
              break;
            }
            case '\'':
            {
              buffer.append('\'');
              buffer.append(tokenizer.getStringValue());
              buffer.append('\'');
              break;
            }
            default:
            {
              buffer.append((char)token);
              break;
            }
          }
        }
        expandedString = buffer.toString();
      }
      
      return expandedString;
    }
  }
  
  //------------------------------------------------------------------------------------------------
  
  /**
   * Determines if the given identifier is defined in the table.
   * 
   * @param identifier The name of the potential macro.
   * @return <b>true</b> if the identifier is defined, otherwise <b>false</b>.
   */
  public boolean isDefined(String identifier)
  {
    return macros.containsKey(identifier);
  }

  //------------------------------------------------------------------------------------------------
  
  /**
   * Determines if the given identifier is defined in the table and has a non-empty expansion text.
   * 
   * @param identifier The name of the potential macro.
   * @return <b>true</b> if the identifier is defined and non-empty, otherwise <b>false</b>.
   */
  public boolean isDefinedNonEmpty(String identifier)
  {
    Macro macro = (Macro) macros.get(identifier);
    if (macro != null && !macro.isEmpty())
      return true;
    else
      return false;
  }
  
  //------------------------------------------------------------------------------------------------
  
  /**
   * Reports an error to the calling application.
   * 
   * @param s Error message to report.
   */
  public void reportError(String s)
  {
    doEvent(IParseEventListener.ERROR, s);
  }

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

  /**
   * Reports general information to the calling application.
   * 
   * @param s Information message to report.
   */
  public void reportInfo(String s)
  {
    doEvent(IParseEventListener.INFORMATION, s);
  }

  //------------------------------------------------------------------------------------------------
  
  /**
   * Reports a warning to the calling application.
   * 
   * @param s Warning message to report.
   */
  public void reportWarning(String s)
  {
    doEvent(IParseEventListener.WARNING, s);
  }

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

  /**
   * Removes the macro definition with the given name from the definition list.
   * If the macro does not exist then nothing happens.
   */
  public void undefineMacro(String identifier)
  {
    macros.remove(identifier);
  }

  //------------------------------------------------------------------------------------------------
  
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品高清| 亚洲成人av在线电影| 亚洲女人的天堂| 蜜桃av一区二区三区电影| 国产成人啪免费观看软件| 欧美亚洲国产怡红院影院| 亚洲国产精品精华液ab| 日本网站在线观看一区二区三区 | 久久精品一级爱片| 亚洲成av人综合在线观看| 不卡免费追剧大全电视剧网站| 91精品国产91热久久久做人人| 亚洲激情第一区| 成人福利视频在线看| 精品毛片乱码1区2区3区| 午夜视黄欧洲亚洲| 色哟哟一区二区三区| 国产精品毛片大码女人| 国产成人综合在线观看| 日韩欧美电影一二三| 日韩中文欧美在线| 欧美私人免费视频| 亚洲一区二区三区四区在线观看 | 日本精品免费观看高清观看| 国产日本欧美一区二区| 久久国产欧美日韩精品| 日韩欧美你懂的| 秋霞影院一区二区| 51精品久久久久久久蜜臀| 一区二区免费在线| 在线看日本不卡| 亚洲综合一区在线| 在线观看日韩国产| 五月天一区二区三区| 欧美日韩一级大片网址| 性久久久久久久| 欧美美女激情18p| 日韩av中文在线观看| 777久久久精品| 韩国一区二区三区| 久久久久久久精| 成人午夜短视频| 日韩美女精品在线| 欧美亚男人的天堂| 午夜一区二区三区视频| 欧美一区二区网站| 国产乱子轮精品视频| 国产精品嫩草99a| 一本一道综合狠狠老| 亚洲午夜在线观看视频在线| 欧美一级免费观看| 国产精品自拍三区| 亚洲图片欧美激情| 欧美日本一区二区三区| 日av在线不卡| 国产精品久久久久久久久免费樱桃| 成人av在线资源网站| 一区二区三区欧美视频| 欧美丰满一区二区免费视频| 国模套图日韩精品一区二区| 国产精品久久影院| 欧美日韩精品高清| 国产一区二区91| 伊人色综合久久天天人手人婷| 欧美日韩国产高清一区二区三区 | 欧美mv和日韩mv国产网站| 国产不卡在线一区| 亚洲第一激情av| 亚洲精品一区二区三区影院| 成人小视频免费在线观看| 亚洲黄色av一区| 精品久久久久久最新网址| www.日韩在线| 免费成人在线播放| 中文字幕一区不卡| 日韩欧美电影一区| 日本高清不卡在线观看| 狠狠色狠狠色综合| 亚洲综合色在线| 国产亚洲精品福利| 欧美精品黑人性xxxx| 成人av电影免费观看| 蜜桃久久久久久久| 亚洲国产视频网站| 中日韩免费视频中文字幕| 91精品免费在线| 一本色道久久综合亚洲91| 国内精品久久久久影院一蜜桃| 一区二区三区色| 一区在线播放视频| 久久久99免费| 日韩一区二区在线观看视频 | 亚洲国产一区在线观看| 久久久影视传媒| 91精品中文字幕一区二区三区| 成人精品在线视频观看| 国内精品写真在线观看| 视频一区二区三区入口| 亚洲欧美日韩国产另类专区| 亚洲国产精品ⅴa在线观看| 日韩视频免费观看高清在线视频| 欧美视频一区在线| 91在线视频网址| av在线不卡免费看| 国产成人亚洲精品狼色在线| 激情六月婷婷综合| 久久精品久久久精品美女| 日本美女一区二区| 欧美aaaaa成人免费观看视频| 亚洲国产另类精品专区| 亚洲成a人片综合在线| 一区二区三区四区五区视频在线观看| 欧美国产日韩a欧美在线观看 | 国产精品每日更新| 国产日产欧美一区二区视频| 久久久久久久综合色一本| 久久奇米777| 国产精品卡一卡二卡三| 中文字幕一区在线观看| 国产精品电影院| 亚洲伦理在线精品| 亚洲国产精品人人做人人爽| 亚洲国产欧美一区二区三区丁香婷| 亚洲色图欧美在线| 亚洲va在线va天堂| 另类小说综合欧美亚洲| 韩国一区二区在线观看| 成人性生交大片免费看视频在线| 成人在线视频一区二区| www.66久久| 欧美三区在线观看| 欧美一区二区女人| www精品美女久久久tv| 国产欧美精品在线观看| 亚洲视频图片小说| 亚洲国产日韩综合久久精品| 免费人成在线不卡| 国产电影一区二区三区| 97久久精品人人澡人人爽| 欧美亚一区二区| 精品国产免费人成在线观看| 久久精品一二三| 亚洲欧美日韩国产中文在线| 亚洲第一成人在线| 国产在线播放一区| 91在线观看成人| 日韩一级片在线观看| 欧美激情一区在线| 午夜电影久久久| 国产激情视频一区二区在线观看| 99re成人精品视频| 欧美一级理论性理论a| 中文字幕av免费专区久久| 亚洲国产日韩一区二区| 狠狠网亚洲精品| 在线免费观看视频一区| 久久综合网色—综合色88| 亚洲免费观看高清| 精品一区二区在线免费观看| 91小视频免费看| 欧美成人国产一区二区| 亚洲人精品一区| 国模无码大尺度一区二区三区| 色婷婷综合中文久久一本| 欧美大片免费久久精品三p| 一区二区高清在线| 成人app网站| 欧美一个色资源| 一区二区三区精品久久久| 精品一区二区三区在线播放视频| 色综合天天综合色综合av | 制服丝袜成人动漫| 中文字幕中文字幕在线一区 | 国产拍欧美日韩视频二区| 天天影视网天天综合色在线播放| 波多野结衣中文字幕一区| 精品少妇一区二区三区免费观看| 亚洲狼人国产精品| 国产成人综合亚洲91猫咪| 日韩精品一区二区在线| 亚洲成人动漫在线免费观看| 一本久久a久久精品亚洲| 国产欧美日韩另类视频免费观看| 男人的天堂亚洲一区| 欧美日韩五月天| 一区二区三区av电影| 91啦中文在线观看| 中文字幕制服丝袜成人av| 国产成人午夜高潮毛片| 精品国产百合女同互慰| 免费视频一区二区| 日韩欧美一级特黄在线播放| 日日摸夜夜添夜夜添精品视频| 欧美在线三级电影| 一区二区三区免费网站| 91成人免费在线视频| 亚洲一区二区三区四区的| 欧美性受极品xxxx喷水| 亚洲国产日产av| 欧美日韩精品电影|