Commit 3abe9331 authored by Elemer Lelik's avatar Elemer Lelik
Browse files

Sync with 5.4.0

parent f99e8b7f
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* Copyright (c) 2000-2015 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -135,9 +135,18 @@ MACRO_REFERENCE_INT \$"{"{WS}{TTCN3IDENTIFIER}{WS}(","{WS}integer{WS})?"}"
"["{WS}MODULE_PARAMETERS{WS}"]" BEGIN(SC_module_parameters);
"["{WS}TESTPORT_PARAMETERS{WS}"]" BEGIN(SC_testport_parameters);
<SC_module_parameters,SC_testport_parameters>
<SC_testport_parameters>
{
"["{NUMBER}"]" ;
}
<SC_module_parameters>
{
"["[ \t0-9a-zA-Z+*/&-]*"]" ;
}
<SC_module_parameters,SC_testport_parameters>
{
"["[^\r\n\[\]]*{MACRO_REFERENCE_INT}{WS}[^\r\n\[\]]*"]" ;
}
......@@ -192,7 +201,7 @@ MACRO_REFERENCE_INT \$"{"{WS}{TTCN3IDENTIFIER}{WS}(","{WS}integer{WS})?"}"
BEGIN(INITIAL);
} else {
preproc_error_flag = 1;
config_preproc_error(error_msg.c_str());
config_preproc_error("%s", error_msg.c_str());
}
}
/* no break */
......
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* Copyright (c) 2000-2015 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......@@ -311,6 +311,7 @@ static void check_memory_address(memory_block *block_ptr, int oper)
#define MALLOC_INTERNAL(f,l,s) Malloc_dbg(f,l,s)
#define MEMPTYSTR_INTERNAL(f,l) memptystr_dbg(f,l)
#define MCOPYSTR_INTERNAL(f,l,s) mcopystr_dbg(f,l,s)
#define MCOPYSTRN_INTERNAL(f,l,s,l2) mcopystrn_dbg(f,l,s,l2)
#define REALLOC_INTERNAL(f,l,p,s) Realloc_dbg(f,l,p,s)
#define FREE_INTERNAL(f,l,p) Free_dbg(f,l,p)
#define MPRINTF_VA_LIST_INTERNAL(f,l,s,p) mprintf_va_list_dbg(f,l,s,p)
......@@ -333,6 +334,7 @@ static void extract_location(void *p, const char **fn, int *ln)
#define MALLOC_INTERNAL(f,l,s) Malloc(s)
#define MEMPTYSTR_INTERNAL(f,l) memptystr()
#define MCOPYSTR_INTERNAL(f,l,s) mcopystr(s)
#define MCOPYSTRN_INTERNAL(f,l,s,l2) mcopystrn(s,l2)
#define REALLOC_INTERNAL(f,l,p,s) Realloc(p,s)
#define FREE_INTERNAL(f,l,p) Free(p)
#define MPRINTF_VA_LIST_INTERNAL(f,l,s,p) mprintf_va_list(s,p)
......@@ -861,7 +863,7 @@ expstring_t mputstrn(expstring_t str, const char *str2, size_t len2)
memset(str + newlen, '\0', newsize - newlen);
}
memcpy(str + len, str2, len2);
} else str = MCOPYSTR_INTERNAL(filename, line, str2);
} else str = MCOPYSTRN_INTERNAL(filename, line, str2, len2);
}
return str;
}
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2014 Ericsson Telecom AB
// Copyright (c) 2000-2015 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
......@@ -20,8 +20,12 @@
* charstring pattern to a POSIX Extended Regular Expression (ERE).
* If error occurs, returns a NULL-pointer. It uses the
* TTCN_pattern_error() and TTCN_pattern_warning() functions to
* report errors/warnings. */
extern char* TTCN_pattern_to_regexp(const char* p_pattern);
* report errors/warnings.
*
* The function is also used on universal charstring patterns (in UTF-8 format)
* during JSON schema generation. In this case the 2nd parameter must be set
* to true, so no errors are reported for the extended ASCII characters. */
extern char* TTCN_pattern_to_regexp(const char* p_pattern, bool utf8 = false);
extern char* TTCN_pattern_to_regexp_uni(const char* p_pattern,
int** groups = 0);
......
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* Copyright (c) 2000-2015 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* Copyright (c) 2000-2015 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -54,6 +54,8 @@
/** The converted regexp. */
static char *ret_val;
/** Turns error messages for extended ASCII characters on or off */
static bool allow_ext_ascii = false;
/** The parser error reporting function. */
static void pattern_yyerror(const char *error_str);
/** Creates the POSIX equivalent of literal character \a c using the
......@@ -406,8 +408,8 @@ RE_OneCharPos:
| TOK_Char
{
unsigned char c = $1;
if (c == 0 || c > 127) TTCN_pattern_error("Character with code %u "
"(0x%02x) cannot be used in a pattern for type charstring.", c, c);
if (c == 0 || (c > 127 && !allow_ext_ascii)) TTCN_pattern_error("Character "
"with code %u (0x%02x) cannot be used in a pattern for type charstring.", c, c);
$$ = translate_character($1);
}
| RE_Quadruple
......@@ -551,8 +553,8 @@ RE_Set_Range_Char:
| TOK_Char
{
unsigned char c = $1;
if (c == 0 || c > 127) TTCN_pattern_error("Character with code %u "
"(0x%02x) cannot be used in a pattern for type charstring.", c, c);
if (c == 0 || (c > 127 && !allow_ext_ascii)) TTCN_pattern_error("Character "
"with code %u (0x%02x) cannot be used in a pattern for type charstring.", c, c);
$$ = $1;
}
| RE_Quadruple { $$ = $1; }
......@@ -621,13 +623,16 @@ RE_Quadruple:
* Interface
*********************************************************************/
char* TTCN_pattern_to_regexp(const char* p_pattern)
char* TTCN_pattern_to_regexp(const char* p_pattern, bool utf8)
{
/* if you want to debug */
//pattern_yydebug=1;
ret_val=NULL;
/* allow extended ASCII characters if the pattern is in UTF-8 format */
allow_ext_ascii = utf8;
yy_buffer_state *flex_buffer = pattern_yy_scan_string(p_pattern);
if(flex_buffer == NULL) {
TTCN_pattern_error("Flex buffer creation failed.");
......
/******************************************************************************
* Copyright (c) 2000-2014 Ericsson Telecom AB
* Copyright (c) 2000-2015 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment