⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 java操作Excel表格的api
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	  int size;	  int bogus_index;	  CAccept accept;	  	  if (CUtility.DEBUG)    {      CUtility.assert(m_spec.m_accept_vector.size()                       == m_spec.m_anchor_array.length);    }	  bogus_index = -2;	  size = m_spec.m_accept_vector.size();	  for (elem = 0; elem < size; ++elem)    {      accept = (CAccept) m_spec.m_accept_vector.elementAt(elem);      if (null != accept)       {        m_outstream.println(tabs + "case " + elem                             + ":");        m_outstream.print(tabs + "\t");        m_outstream.print(new String(accept.m_action,0,                                     accept.m_action_read));        m_outstream.println();        m_outstream.println(tabs + "case " + bogus_index + ":");        m_outstream.println(tabs + "\tbreak;");        --bogus_index;      }    }	}    /***************************************************************    Function: emit_footer    Description:       **************************************************************/  private void emit_footer    (     )    throws java.io.IOException  {    if (CUtility.DEBUG)	  {	    CUtility.assert(null != m_spec);	    CUtility.assert(null != m_outstream);	  }    m_outstream.println("}");  }}/***************************************************************  Class: CBunch**************************************************************/class CBunch{  /***************************************************************    Member Variables  **************************************************************/  Vector m_nfa_set; /* Vector of CNfa states in dfa state. */  SparseBitSet m_nfa_bit; /* BitSet representation of CNfa labels. */  CAccept m_accept; /* Accepting actions, or null if nonaccepting state. */  int m_anchor; /* Anchors on regular expression. */  int m_accept_index; /* CNfa index corresponding to accepting actions. */  /***************************************************************    Function: CBunch    Description: Constructor.  **************************************************************/  CBunch    (     )  {    m_nfa_set = null;    m_nfa_bit = null;    m_accept = null;    m_anchor = CSpec.NONE;    m_accept_index = -1;  }}/***************************************************************  Class: CMakeNfa**************************************************************/class CMakeNfa{  /***************************************************************    Member Variables  **************************************************************/  private CSpec m_spec;  private CLexGen m_lexGen;  private CInput m_input;  /***************************************************************    Function: CMakeNfa    Description: Constructor.  **************************************************************/  CMakeNfa    (     )  {    reset();  }  /***************************************************************    Function: reset    Description: Resets CMakeNfa member variables.  **************************************************************/  private void reset    (     )  {    m_input = null;    m_lexGen = null;    m_spec = null;  }  /***************************************************************    Function: set    Description: Sets CMakeNfa member variables.  **************************************************************/  private void set    (     CLexGen lexGen,     CSpec spec,     CInput input     )  {    if (CUtility.DEBUG)	  {	    CUtility.assert(null != input);	    CUtility.assert(null != lexGen);	    CUtility.assert(null != spec);	  }    m_input = input;    m_lexGen = lexGen;    m_spec = spec;  }  /***************************************************************    Function: allocate_BOL_EOF    Description: Expands character class to include special BOL and    EOF characters.  Puts numeric index of these characters in    input CSpec.  **************************************************************/  void allocate_BOL_EOF    (     CSpec spec     )	{	  CUtility.assert(CSpec.NUM_PSEUDO==2);	  spec.BOL = spec.m_dtrans_ncols++;	  spec.EOF = spec.m_dtrans_ncols++;	}  /***************************************************************    Function: thompson    Description: High level access function to module.    Deposits result in input CSpec.  **************************************************************/  void thompson    (     CLexGen lexGen,     CSpec spec,     CInput input     )    throws java.io.IOException      	{	  int i;	  CNfa elem;	  int size;	  /* Set member variables. */	  reset();	  set(lexGen,spec,input);	  size = m_spec.m_states.size();	  m_spec.m_state_rules = new Vector[size];	  for (i = 0; i < size; ++i)    {      m_spec.m_state_rules[i] = new Vector();    }	  /* Initialize current token variable 	     and create nfa. */	  /*m_spec.m_current_token = m_lexGen.EOS;      m_lexGen.advance();*/	  m_spec.m_nfa_start = machine();	  	  /* Set labels in created nfa machine. */	  size = m_spec.m_nfa_states.size();	  for (i = 0; i < size; ++i)    {      elem = (CNfa) m_spec.m_nfa_states.elementAt(i);      elem.m_label = i;    }	  /* Debugging output. */	  if (CUtility.DO_DEBUG)    {      m_lexGen.print_nfa();    }	  if (m_spec.m_verbose)    {      System.out.println("NFA comprised of "                          + (m_spec.m_nfa_states.size() + 1)                          + " states.");    }	  reset();	}       /***************************************************************    Function: discardCNfa    Description:   **************************************************************/  private void discardCNfa    (     CNfa nfa     )  {    m_spec.m_nfa_states.removeElement(nfa);  }  /***************************************************************    Function: processStates    Description:  **************************************************************/  private void processStates    (     SparseBitSet states,     CNfa current     )  {    int size;    int i;	    size = m_spec.m_states.size();    for (i = 0; i <  size; ++i)	  {	    if (states.get(i))      {        m_spec.m_state_rules[i].addElement(current);      }	  }  }  /***************************************************************    Function: machine    Description: Recursive descent regular expression parser.  **************************************************************/  private CNfa machine    (     )    throws java.io.IOException   {    CNfa start;    CNfa p;    SparseBitSet states;    if (CUtility.DESCENT_DEBUG)	  {	    CUtility.enter("machine",m_spec.m_lexeme,m_spec.m_current_token);	  }    start = CAlloc.newCNfa(m_spec);    p = start;	        states = m_lexGen.getStates();    /* Begin: Added for states. */    m_spec.m_current_token = m_lexGen.EOS;    m_lexGen.advance();    /* End: Added for states. */	    if (m_lexGen.END_OF_INPUT != m_spec.m_current_token) // CSA fix.	  {	    p.m_next = rule();	    	    processStates(states,p.m_next);	  }    while (m_lexGen.END_OF_INPUT != m_spec.m_current_token)	  {	    /* Make state changes HERE. */	    states = m_lexGen.getStates();		    /* Begin: Added for states. */	    m_lexGen.advance();	    if (m_lexGen.END_OF_INPUT == m_spec.m_current_token)      {         break;      }	    /* End: Added for states. */	    	    p.m_next2 = CAlloc.newCNfa(m_spec);	    p = p.m_next2;	    p.m_next = rule();	    	    processStates(states,p.m_next);	  }    // CSA: add pseudo-rules for BOL and EOF    SparseBitSet all_states = new SparseBitSet();    for (int i = 0; i < m_spec.m_states.size(); ++i)      all_states.set(i);    p.m_next2 = CAlloc.newCNfa(m_spec);    p = p.m_next2;    p.m_next = CAlloc.newCNfa(m_spec);    p.m_next.m_edge = CNfa.CCL;    p.m_next.m_next = CAlloc.newCNfa(m_spec);    p.m_next.m_set = new CSet();    p.m_next.m_set.add(m_spec.BOL);    p.m_next.m_set.add(m_spec.EOF);    p.m_next.m_next.m_accept = // do-nothing accept rule	    new CAccept(new char[0], 0, m_input.m_line_number+1);    processStates(all_states,p.m_next);    // CSA: done.     if (CUtility.DESCENT_DEBUG)	  {	    CUtility.leave("machine",m_spec.m_lexeme,m_spec.m_current_token);	  }    return start;  }    /***************************************************************    Function: rule    Description: Recursive descent regular expression parser.  **************************************************************/  private CNfa rule    (     )    throws java.io.IOException   {    CNfaPair pair;     CNfa p;    CNfa start = null;    CNfa end = null;    int anchor = CSpec.NONE;    if (CUtility.DESCENT_DEBUG)	  {	    CUtility.enter("rule",m_spec.m_lexeme,m_spec.m_current_token);	  }    pair = CAlloc.newCNfaPair();    if (m_lexGen.AT_BOL == m_spec.m_current_token)	  {	    anchor = anchor | CSpec.START;	    m_lexGen.advance();	    expr(pair);	    // CSA: fixed beginning-of-line operator. 8-aug-1999	    start = CAlloc.newCNfa(m_spec);	    start.m_edge = m_spec.BOL;	    start.m_next = pair.m_start;	    end = pair.m_end;	  }    else	  {	    expr(pair);	    start = pair.m_start;	    end = pair.m_end;	  }    if (m_lexGen.AT_EOL == m_spec.m_current_token)	  {	    m_lexGen.advance();	    // CSA: fixed end-of-line operator. 8-aug-1999	    CNfaPair nlpair = CAlloc.newNLPair(m_spec);	    end.m_next = CAlloc.newCNfa(m_spec);	    end.m_next.m_next = nlpair.m_start;	    end.m_next.m_next2 = CAlloc.newCNfa(m_spec);	    end.m_next.m_next2.m_edge = m_spec.EOF;	    end.m_next.m_next2.m_next = nlpair.m_end;	    end = nlpair.m_end;	    anchor = anchor | CSpec.END;	  }    /* Check for null rules. Charles Fischer found this bug. [CSA] */    if (end==null)	    CError.parse_error(CError.E_ZERO, m_input.m_line_number);    /* Handle end of regular expression.  See page 103. */    end.m_accept = m_lexGen.packAcc

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -