Click here to Skip to main content
15,880,469 members

Comments by shivareaj (Top 5 by date)

shivareaj 20-Aug-13 10:59am View    
// regex TR1 header
#pragma once
#ifndef _REGEX_
#define _REGEX_
#ifndef RC_INVOKED

#ifndef _DISABLE_TRIGRAPH_WARNINGS
#pragma warning(default: 4837)
#endif /* _DISABLE_TRIGRAPH_WARNINGS */

#include <algorithm>
#include <iterator>
#include <limits>
#include <locale>
#include <memory>
#include <string>
#include <stdexcept>
#include <utility>
#include <vector>

#include <ctype.h>
#include <wchar.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>

#pragma pack(push,_CRT_PACKING)
#pragma warning(push,3)

#if _HAS_EXCEPTIONS

#else /* _HAS_EXCEPTIONS */
#error regex without exception handling not supported
#endif /* _HAS_EXCEPTIONS */

#ifndef _ENHANCED_REGEX_VISUALIZER

#ifdef _DEBUG
#define _ENHANCED_REGEX_VISUALIZER 1

#else /* _DEBUG */
#define _ENHANCED_REGEX_VISUALIZER 0
#endif /* _DEBUG */

#endif /* _ENHANCED_REGEX_VISUALIZER */

#define _REGEX_DIFFT(iter) \
typename iterator_traits<iter>::difference_type
#define _REGEX_VALT(iter) \
typename iterator_traits<iter>::value_type

_STD_BEGIN
namespace tr1 { // TR1 additions
// NAMED CONSTANTS
enum _Meta_type
{ // meta character representations for parser
_Meta_lpar = '(',
_Meta_rpar = ')',
_Meta_dlr = '$',
_Meta_caret = '^',
_Meta_dot = '.',
_Meta_star = '*',
_Meta_plus = '+',
_Meta_query = '?',
_Meta_lsq = '[',
_Meta_rsq = ']',
_Meta_bar = '|',
_Meta_esc = '\\',
_Meta_dash = '-',
_Meta_lbr = '{',
_Meta_rbr = '}',
_Meta_comma = ',',
_Meta_colon = ':',
_Meta_equal = '=',
_Meta_exc = '!',
_Meta_eos = -1,
_Meta_nl = '\n',
_Meta_cr = '\r',
_Meta_bsp = '\b',
_Meta_chr = 0,

_Esc_bsl = '\\',
_Esc_word = 'b',
_Esc_not_word = 'B',
_Esc_ctrl_a = 'a',
_Esc_ctrl_b = 'b',
_Esc_ctrl_f = 'f',
_Esc_ctrl_n = 'n',
_Esc_ctrl_r = 'r',
_Esc_ctrl_t = 't',
_Esc_ctrl_v = 'v',
_Esc_ctrl = 'c',
_Esc_hex = 'x',
_Esc_uni = 'u'
};

// NAMESPACE regex_constants
#define _REGEX_BITMASK_OPS(Ty) \
inline Ty& operator&=(Ty& _Left, Ty _Right) \
{ /* return _Left &= _Right */ \
_Left = (Ty)((int)_Left & (int)_Right); return (_Left); \
} \
\
inline Ty& operator|=(Ty& _Left, Ty _Right) \
{ /* return _Left |= _Right */ \
_Left = (Ty)((int)_Left | (int)_Right); return (_Left); \
} \
\
inline Ty& operator^=(Ty& _Left, Ty _Right) \
{ /* return _Left ^= _Right */ \
_Left = (Ty)((int)_Left ^ (int)_Right); return (_Left); \
} \
\
inline Ty operator&(Ty _Left, Ty _Right) \
{ /* return _Left & _Right */ \
return ((Ty)((int)_Left & (int)_Right)); \
} \
\
inline Ty operator|(Ty _Left, Ty _Right) \
{ /* return _Left | _Right */ \
return ((Ty)((int)_Left | (int)_Right)); \
} \
\
inline Ty operator^(Ty _Left, Ty _Right) \
{ /* return _Left ^ _Right */ \
return ((Ty)((int)_Left ^ (int)_Right)); \
} \
\
inline Ty operator~(Ty _Left) \
{ /* return ~_Left */ \
return ((Ty)~(int)_Left); \
}

namespace regex_constants {
// constants used in regular expressions
enum syntax_option_type
{ // specify RE syntax rules
ECMAScript = 0x01,
basic = 0x02,
extended = 0x04,
awk = 0x08,
grep = 0x10,
egrep = 0x20,
_Gmask = 0x3F,

icase = 0x0100,
nosubs = 0x0200,
optimize = 0x0400,
collate = 0x0800
};

_REGEX_BITMASK_OPS(syntax_option_type)

enum match_flag_type
{ // specify matching and formatting rules
match_default = 0x0000,
match_not_bol = 0x0001,
match_not_eol = 0x0002,
match_not_bow = 0x0004,
match_not_eow = 0x0008,
match_any = 0x0010,
match_not_null = 0x0020,
match_continuous = 0x0040,
_Match_partial = 0x0080,
match_prev_avail = 0x0100,
format_default = 0x0000,
format_sed = 0x0400,
format_no_copy = 0x0800,
format_first_only = 0x1000,
_Match_not_null = 0x2000
};

_REGEX_BITMASK_OPS(match_flag_type)

enum error_type
{ // identify error
error_collate,
error_ctype,
error_escape,
error_backref,
error_brack,
error_paren,
error_brace,
error_badbrace,
error_range,
error_space,
error_badrepeat,
error_complexity,
error_stack,
error_parse,
error_syntax
};
} // namespace regex_constants

_C
shivareaj 20-Aug-13 10:52am View    
Sorry I have done some modification in regex (include file) I forgot to mention that. If you use my regex file, it should compile.
I don't know how can i attach my regex file here
shivareaj 20-Aug-13 1:50am View    
Oh i see, but i was using VC 2010. I think you can reproduce in vc2010
shivareaj 20-Aug-13 1:49am View    
Sorry i could write symbols <, > as it was interpreted some other . Please add those symbols in #include while you compiling.
It is sure that there is no build errors.
shivareaj 20-Aug-13 1:45am View    
Many thanks for your reply.

I don't have idea on which lib file to include in linker settings.
Please guide.