Mercurial > pub > ImplabNet
diff Implab/Automaton/Scanner.cs @ 165:e227e78d72e4 ref20160224
DFA refactoring
author | cin |
---|---|
date | Mon, 29 Feb 2016 02:02:17 +0300 |
parents | ec35731ae299 |
children | 92d5278d1b10 |
line wrap: on
line diff
--- a/Implab/Automaton/Scanner.cs Thu Feb 25 02:11:13 2016 +0300 +++ b/Implab/Automaton/Scanner.cs Mon Feb 29 02:02:17 2016 +0300 @@ -29,7 +29,7 @@ protected DFAStateDescriptior<TTag> m_currentState; int m_previewCode; - protected int m_tokenLen = 0; + protected int m_tokenLen; protected int m_tokenOffset; protected char[] m_buffer; @@ -142,18 +142,17 @@ if (nextState == DFAConst.UNREACHABLE_STATE) { if (m_currentState.final) return true; - else - throw new ParserException( - String.Format( - "Unexpected symbol '{0}', at pos {1}", - m_buffer[m_pointer], - Position - ) - ); - } else { - m_currentState = m_states[nextState]; - m_tokenLen++; + + throw new ParserException( + String.Format( + "Unexpected symbol '{0}', at pos {1}", + m_buffer[m_pointer], + Position + ) + ); } + m_currentState = m_states[nextState]; + m_tokenLen++; } while (Shift()); @@ -220,6 +219,7 @@ /// </summary> /// <param name="states">Таблица состояний нового ДКА</param> /// <param name="alphabet">Таблица входных символов для нового ДКА</param> + /// <param name = "initialState"></param> protected void Switch(DFAStateDescriptior<TTag>[] states, int[] alphabet, int initialState) { Safe.ArgumentNotNull(states, "dfa");