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

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

?? identifierchecker.java

?? java實現的一個pascal編譯器
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* File : IdentifierChecker.java
   Description: This class is belongs to one of the phases of the Semantic analyzer for 
   		JPascal, which checks that a variable, 
   		constant or process are declared only once. That there cannot be
   		a constant with the same name of a process or variable, and
   		vice versa.
   Author: Fidel Viegas (viegasfh@yahoo.com)
   Date: 12/02/1999
   Last Modification Date: 16/03/2000
*/
package uk.co.brainycreatures.jpascal.semantic;

import uk.co.brainycreatures.jpascal.analysis.*;
import uk.co.brainycreatures.jpascal.node.*;

import java.util.Hashtable;
import java.util.Vector;
import java.io.*;

/**
 * This class is the first stage of the Semantic Analysis phase. It checks that all the identifiers are declared 
 * only once and that they are declared before use. It also checks that the integer, real and character literals 
 * are not out of range.
 */
public class IdentifierChecker extends DepthFirstAdapter {
  /**
   * processes the storage of identifiers of a program and/or subprograms, monitors and processes.
   */
  private Hashtable global_table = new Hashtable();

  /**
   * stores the identifiers of a monitor.
   */
  private Hashtable monitor_table = new Hashtable();

  /**
   * set to true when a procedure or function are given arguments
   */
  private boolean throws_args = false;

  /**
   * used by previous_entity
   */
  private final short PROGRAM = 0;
 
  /**
   * set to true when a readln statement with arguments is
   * found.
   */
  private boolean readln_statement = false;

  /** 
   * used by previous_entity
   */
  private final short MONITOR = 1;

  /**
   * program or monitor
   */
   private short previous_entity = PROGRAM;

  /**
   * stores identifiers local to a function, procedure or process
   */
  private Hashtable local_table = new Hashtable();

  /**
   * Reports the error messages within a program.
    */
  private ErrorMessage err = new ErrorMessage();

  /**
   * Lets the Identifier Checker know that this is a program.  
   */
  private boolean program = true;

  /**
   * stores the procedures local to a monitor
   */
  private Hashtable monitor_procs = new Hashtable();

  /**
   * true if the entity is a monitor
   */
  private boolean monitor = false;

  /**
   * set to true if a monitor_call
   */
  private boolean monitor_call = false;

  /**
   * Stores the name of the current monitor, so that when declaring
   * procedures local to a monitor
   * can be checked against the monitor's name.
   */
  private String monitor_name;

  /**
   * Stores the name of the program
   */
  private String program_name;

  /**
   * Adds a new symbol table to the linked list
   * symbol_table.
   */
  public void caseAPresentProgramHeading(APresentProgramHeading node) {
    program_name = node.getIdentifier().getText();
  }

  /**
   * @see IdentifierChecker.caseAPresentProgramHeading
   */
  public void caseAEmptyProgramHeading(APresentProgramHeading node) {
    program_name = "Noname";
  }

  /**
   *  Checks if the new constant identifier being defined already exists. If it exists, then an error message
   * is reported. If it doesn't, then it is put in the symbol table of the current block(process, monitor, program,
   * subprogram.
   *
   * @parameter node This is the node representing a constant in the AST.
   */
  public void outAConstDeclaration(AConstDeclaration node){
    checkNewId(node.getIdentifier());
  }

  /**
   *  Checks if the constant identifier on the right hand side of the new constant being defined is
   * already defined.
   * @parameter node Represents the identifier of the constant on the right hand side of a const
   *                       constant declaration in the AST.
   */
  public void outASignedidentifierConstant(ASignedidentifierConstant node) {
    checkId(node.getIdentifier());
  }

  /**
   * @see IdentifierChecker.outASignedIdentifierConstant
   */
  public void outAIdentifierConstant(AIdentifierConstant node) {
    checkId(node.getIdentifier());
  }

  /**
   * If the identifier is from an export section, then put it in the export table
   * else, check if the identifier was already declared and report an error if it was.
   *
   * @param node Represents the node of the identifier being declared.
   */
  public void outASingleIdentifierList(ASingleIdentifierList node) {
    TIdentifier ident = node.getIdentifier();
    String key = ident.getText().toUpperCase();
    
    if (readln_statement || throws_args) {
      checkId(ident); // check if the identifier was declared
    }
    else {
      checkNewId(ident);
    }
  }

  /**
   * @see IdentifierChecker.outASingleIdentifierList
   */
  public void outASequenceIdentifierList(ASequenceIdentifierList node){
    TIdentifier ident = node.getIdentifier();
    String key = ident.getText().toUpperCase();

    if (readln_statement || throws_args) {
      checkId(ident); // check if the identifier was declared
    }
    else {
      checkNewId(ident);
    }
  }

  /**
   * checks if the identifier is already in the table and if it isn't
   * equal to a procedure, function, monitor or process if this is not
   * a program declaration.
   */
  public void outASimpleProcedureHeading(ASimpleProcedureHeading node) {
    checkProcedure(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear();
    }
  }
  
  /**
   * {simple_throws} procedure identifier semicolon throws identifierlist
   */
  public void inASimpleThrowsProcedureHeading(ASimpleThrowsProcedureHeading node) {
    checkProcedure(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear();
    }
    throws_args = true;
  }

  /**
   * out simple throws
   */
  public void outASimpleThrowsProcedureHeading(ASimpleThrowsProcedureHeading node) {
    throws_args = false;
  }

  /**
   * @see IdentifierChecker.outASimpleProcedureDeclarationHeading
   */
 public void inAArgumentsProcedureHeading(AArgumentsProcedureHeading node) {
    checkProcedure(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear(); 
    }
  }

  public void caseAArgumentsThrowsProcedureHeading(AArgumentsThrowsProcedureHeading node) {
    checkProcedure(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear(); 
    }
    if (node.getParameterList() != null) {
      node.getParameterList().apply(this);
    }

    throws_args = true;
    if (node.getIdentifierList() != null) {
      node.getIdentifierList().apply(this);
    }
    throws_args = false;
  }

  /**
   * @see IdentifierChecker.checkSubProgramHeading
   */
  public void outASimpleFunctionHeading(ASimpleFunctionHeading node) {
    checkFunction(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear();
    }
  }

  public void caseASimpleThrowsFunctionHeading(ASimpleThrowsFunctionHeading node) {
    checkFunction(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear();
    }

    throws_args = true;
    if (node.getIdentifierList() != null ) {
      node.getIdentifierList().apply(this);
    }
    throws_args = false;
  }

  /**
   * checks if the exceptions identifiers where previously declared
   */
  public void caseAArgumentsFunctionHeading(AArgumentsFunctionHeading node) {
    checkFunction(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear();
    }
    
    if (node.getParameterList() != null) {
      node.getParameterList().apply(this);
    }
  }

  /**
   * checks if the exceptions identifiers where previously declared
   */
  public void caseAArgumentsThrowsFunctionHeading(AArgumentsThrowsFunctionHeading node) {
    checkFunction(node.getIdentifier());
    if (!local_table.isEmpty()) {
      local_table.clear();
    }
    if (node.getParameterList() != null) {
      node.getParameterList().apply(this);
    }
    throws_args = true;
    if (node.getIdentifierList() != null) {
      node.getIdentifierList().apply(this);
    }
    throws_args = false;
  }

  /**
   * checks if the identifier already exists in the global table
   */
  public void outAMonitorHeading(AMonitorHeading node) {
    TIdentifier ident = node.getIdentifier();
    String key = ident.getText().toUpperCase();

    checkMonitor(ident);
    program = false;
    monitor = true;
    monitor_name = ident.getText();
    if (!monitor_table.isEmpty()) {
      monitor_table.clear();
    }
    monitor_procs = new Hashtable();
  }

  /**
   * @see IdentifierChecker.outAMonitorHeading
   */
  public void outAProcessHeading(AProcessHeading node) {
    TIdentifier ident = node.getIdentifier();
    String key = ident.getText().toUpperCase();

    checkProcess(ident);
    program = false;
    if (!local_table.isEmpty()) {
      local_table.clear();
    }
  }

  /**
   * sets inner to false if it is true or
   * not_a_program to false
   */
  public void outAProcedureDeclaration(AProcedureDeclaration node) {
    if (previous_entity == PROGRAM) {
      program = true;
    }
    else {
      monitor = true;
    }
  }

  /**
   * sets inner to false if it is true or
   * not_a_program to false
   */
  public void outAFunctionDeclaration(AFunctionDeclaration node) {
    program = true;
  }

  /**
   * sets not_a_program to false
   * and removes the current table from the list
   */
  public void outAProcessDeclaration(AProcessDeclaration node) {
    program = true;
  }

  /**
   * checks if the identifiers in the export list exist and that
   * they are not repeated in the list
   */
  public void outAMonitorDeclaration(AMonitorDeclaration node) {
    program = true;
    monitor = false;
    ((Monitor) global_table.get(monitor_name.toUpperCase())).
        setTable(monitor_procs);
  }

  /**
   * checks if the identifier exists
   */
  public void outAIdentifierIndex(AIdentifierIndex node) {
    checkId(node.getIdentifier());
  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲香蕉伊在人在线观| 国内精品免费**视频| 日本不卡1234视频| 成人app下载| 538在线一区二区精品国产| 国产精品久线在线观看| 久久电影网站中文字幕| 91麻豆精东视频| 久久久www成人免费无遮挡大片| 亚洲免费三区一区二区| 国产一区在线观看麻豆| 欧美日韩高清在线播放| 中文一区一区三区高中清不卡| 日韩av中文字幕一区二区| 91美女在线看| 久久国产三级精品| 欧美日韩国产一二三| 中文字幕一区二区三区在线不卡| 捆绑调教一区二区三区| 精品视频色一区| 亚洲视频 欧洲视频| 国产一区二区三区四区五区入口| 欧美一区二区三区不卡| 亚洲综合一区二区精品导航| 99久久久久久99| 国产日产欧美一区| 国产精品99久| 91蜜桃网址入口| 国产精品嫩草影院av蜜臀| 狠狠久久亚洲欧美| 亚洲精品成人天堂一二三| 国产夫妻精品视频| 日韩一二三区视频| 日韩av中文字幕一区二区| 欧美久久久久久蜜桃| 日韩一级视频免费观看在线| 图片区小说区区亚洲影院| 欧美三日本三级三级在线播放| 亚洲素人一区二区| 色激情天天射综合网| 一区二区三区高清在线| 欧美挠脚心视频网站| 亚洲电影激情视频网站| 欧美精品一卡二卡| 久久er精品视频| 久久久国产综合精品女国产盗摄| 大桥未久av一区二区三区中文| 欧美日韩激情一区二区三区| 久久综合色8888| www.在线欧美| 亚洲制服丝袜一区| 欧美人妖巨大在线| 国内精品在线播放| 国产精品电影一区二区| 欧美影院一区二区三区| 日韩精品免费专区| 久久久天堂av| 91成人在线精品| 奇米四色…亚洲| 国产欧美一区二区精品秋霞影院 | 亚洲天堂中文字幕| 日本韩国精品在线| 日本强好片久久久久久aaa| 日韩一区二区影院| 国产成人精品三级麻豆| 一区二区成人在线| 精品欧美一区二区久久| 不卡的av网站| 免费人成精品欧美精品| 日本一区二区三级电影在线观看| 97se亚洲国产综合自在线| 日韩精品91亚洲二区在线观看| 久久一留热品黄| 欧洲在线/亚洲| 国产精品 日产精品 欧美精品| 亚洲激情在线播放| 欧美精品一区二区三区蜜桃| 高清不卡在线观看av| 日日欢夜夜爽一区| 中文字幕亚洲一区二区av在线| 欧美一级生活片| 91视频免费观看| 精品一区二区三区在线观看| 亚洲人成网站色在线观看| 日韩你懂的电影在线观看| 一本到三区不卡视频| 激情文学综合网| 亚洲gay无套男同| 国产精品久久久久精k8 | 91在线看国产| 国产乱码一区二区三区| 日日夜夜一区二区| 国产精品色婷婷| 久久久久久电影| 欧美在线视频日韩| 亚洲免费观看高清完整版在线观看 | 99精品欧美一区二区蜜桃免费| 免费在线观看视频一区| 一区二区三区日韩欧美精品| 国产欧美日韩中文久久| 欧美一区二区网站| 欧美图片一区二区三区| av激情综合网| 国产999精品久久久久久| 久久成人综合网| 美女久久久精品| 日韩av中文在线观看| 亚洲成av人在线观看| 一区二区三区精品在线观看| 国产精品亲子伦对白| 国产视频一区不卡| 久久久久97国产精华液好用吗| 日韩欧美久久一区| 欧美一区二区三区公司| 欧美电影在哪看比较好| 国产欧美日韩麻豆91| 日韩女优制服丝袜电影| 日韩一级免费观看| 日韩三级中文字幕| 欧美大片在线观看| 精品国产91乱码一区二区三区| 欧美一区二区三区免费大片| 91.xcao| 欧美一区二区视频免费观看| 欧美一级欧美三级| 日韩一区二区三区av| 日韩无一区二区| 精品女同一区二区| 久久久精品免费网站| 2021国产精品久久精品| 久久久久久综合| 国产精品情趣视频| 有码一区二区三区| 日韩激情视频在线观看| 久久精品噜噜噜成人88aⅴ| 国产精品影视天天线| 懂色av一区二区夜夜嗨| 成人激情免费网站| 欧美色综合网站| 日韩精品专区在线| 日本一二三不卡| 一卡二卡三卡日韩欧美| 免费精品99久久国产综合精品| 久久福利资源站| 久久蜜桃一区二区| 国产精品网站在线播放| 一区二区三区精品久久久| 天堂成人免费av电影一区| 国产乱码精品1区2区3区| 91视频你懂的| 精品久久一区二区| 亚洲男人天堂av| 精品一区二区免费视频| 日本精品视频一区二区三区| 3d动漫精品啪啪一区二区竹菊| 国产女同互慰高潮91漫画| 亚洲午夜久久久久久久久电影院| 久久精品国产一区二区三区免费看| 成人午夜大片免费观看| 欧美精品v日韩精品v韩国精品v| 欧美mv和日韩mv国产网站| 亚洲人吸女人奶水| 精品一区二区三区影院在线午夜| 91网站最新地址| 精品国产伦一区二区三区观看方式 | 91免费观看在线| 精品国一区二区三区| 尤物在线观看一区| 豆国产96在线|亚洲| 欧美日韩精品欧美日韩精品 | 成人免费毛片aaaaa**| 欧美精品v日韩精品v韩国精品v| 国产精品亲子乱子伦xxxx裸| 免费看欧美女人艹b| 色综合夜色一区| 久久嫩草精品久久久精品一| 亚洲图片欧美色图| 色哟哟国产精品免费观看| 久久精品亚洲麻豆av一区二区| 五月天一区二区| 欧美视频第二页| 亚洲免费毛片网站| 成人18精品视频| 久久久三级国产网站| 久久精品国产亚洲a| 欧美无乱码久久久免费午夜一区 | 久久色在线观看| 免费成人在线观看| 欧美理论电影在线| 亚洲成人免费av| 欧美日韩一区不卡| 亚洲永久精品国产| 91电影在线观看| 亚洲国产综合91精品麻豆| 色婷婷亚洲一区二区三区| 国产精品看片你懂得| 成人福利视频网站| 亚洲欧洲日韩女同| av在线播放一区二区三区| 中文字幕欧美三区|