00001
00002
00004
00005 #if !defined(AFX_VALUES_H__E2AD49D0_E699_413C_9C3D_69DBCD37A4F1__INCLUDED_)
00006 #define AFX_VALUES_H__E2AD49D0_E699_413C_9C3D_69DBCD37A4F1__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012 #include "bin_digit.h"
00013 #include "hex_digit.h"
00014 #include "number.h"
00015
00016 template< class Type >
00017 class values
00018 {
00019 grammar_to_parser::non_terminal< number< bin_digit, 'b' > > bin_number;
00020 grammar_to_parser::non_terminal< number< hex_digit, 'x' > > hex_number;
00021 grammar_to_parser::value_parser<Type> m_dec_number;
00022 public:
00023 void push_parsers( grammar_to_parser::parsers &l )
00024 {
00025 l.push_back( &bin_number );
00026 l.push_back( &hex_number );
00027 l.push_back( &m_dec_number );
00028 }
00029 Type evaluate()
00030 {
00031 if( bin_number.is_parsed() ) return bin_number->evaluate();
00032 if( hex_number.is_parsed() ) return hex_number->evaluate();
00033 if( m_dec_number.is_parsed() ) return m_dec_number.get_valid();
00034 return 0;
00035 }
00036 };
00037
00038 #endif // !defined(AFX_VALUES_H__E2AD49D0_E699_413C_9C3D_69DBCD37A4F1__INCLUDED_)