Commit 9b746e3e authored by Denis Filatov's avatar Denis Filatov
Browse files

Merge branch 'tijinkj/cdd_ts102894_2-master' into WI-00194

parents 657ca80c 9bdc9225
Loading
Loading
Loading
Loading
+6468 −6440

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Original line Diff line number Diff line
# ASN.1 modules for ETSI ITS Common Data Dictionary (ETSI TS 102 894-2)
# ASN.1 modules for ETSI ITS Common Data Dictionary (ETSI TS 102 894-2) Release 2


The ASN.1 module for ETSI ITS Common Data Dictionary (CDD) is contained in the **ITS-Container.asn** file.
The ASN.1 module for ETSI ITS Common Data Dictionary (CDD) is contained in the **ETSI-ITS-CDD.asn** file.
* The module will published in the ETSI TS 102 894-2 v2.1.1 and is based on the **[ETSI TS 102 894-2 v1.3.1](https://www.etsi.org/deliver/etsi_ts/102800_102899/10289402/01.03.01_60/ts_10289402v010301p.pdf)** (2018-08).
* The module is published in the **[ETSI TS 102 894-2 v2.1.1](https://www.etsi.org/deliver/etsi_ts/102800_102899/10289402/02.01.01_60/ts_10289402v020101p.pdf)**.


## License
## License


+22 −5
Original line number Original line Diff line number Diff line
@@ -42,6 +42,9 @@ RE_DOXY_C_COMMENTS = re.compile(r'^\s*/\*\*\s(.*?)\*/', re.MULTILINE | re.DOTALL
RE_DOXY_C_COMMENTS_I = re.compile(r'\s*\*+')
RE_DOXY_C_COMMENTS_I = re.compile(r'\s*\*+')
RE_STRIPSTAR = re.compile(r'^\s*\*', re.MULTILINE)
RE_STRIPSTAR = re.compile(r'^\s*\*', re.MULTILINE)
RE_POWER_SIGN = re.compile('\^(-?\w+|\(.*?\))')
RE_POWER_SIGN = re.compile('\^(-?\w+|\(.*?\))')
RE_GREATEQ_SIGN = re.compile(r'(?<=\s)>=(?=\s)')
RE_LESSEQ_SIGN = re.compile(r'(?<=\s)<=(?=\s)')
RE_REFERENCE_NUMBER = re.compile(r'\[(?:i\.)?\d+\]')




RE_DOXY_REF = re.compile(r'@ref\s+([\w-]+)')
RE_DOXY_REF = re.compile(r'@ref\s+([\w-]+)')
@@ -56,6 +59,7 @@ RE_DOXY_CATEGORY = re.compile(r'^\s*@category[\s:]+(.+)\n', re.MULTILINE)
RE_DOXY_PARAM = re.compile(r'^\s*@(?:param|field):?\s+([\w-]+)\s*(.*?)\n\s*$', re.MULTILINE | re.DOTALL)
RE_DOXY_PARAM = re.compile(r'^\s*@(?:param|field):?\s+([\w-]+)\s*(.*?)\n\s*$', re.MULTILINE | re.DOTALL)


RE_DOXY_SECTION = re.compile(r"^\s*@(brief|note|(class|struct|param|field|details)\s+([-\w]+)):?(.*?)(?=\n\s*@|\n\s*\n|\Z)", re.MULTILINE | re.DOTALL)
RE_DOXY_SECTION = re.compile(r"^\s*@(brief|note|(class|struct|param|field|details)\s+([-\w]+)):?(.*?)(?=\n\s*@|\n\s*\n|\Z)", re.MULTILINE | re.DOTALL)
RE_NOTE_SECTION = re.compile(r"^\s*@(note):?(.*?)(?=\n\s*@|\n\s*\n|\Z)", re.MULTILINE | re.DOTALL)


# RE_TYPE = re.compile(r'(([A-Z][\w-]*)\s*::=[\w \t]+(?:{+(.*?)}+)?.*?)\n\s*\n', re.MULTILINE | re.DOTALL)
# RE_TYPE = re.compile(r'(([A-Z][\w-]*)\s*::=[\w \t]+(?:{+(.*?)}+)?.*?)\n\s*\n', re.MULTILINE | re.DOTALL)
RE_TYPE = re.compile(r'^\s*([A-Z][\w-]*)?\s*([{} \t:\w-]*?)?::=([\w \t]+.*?)\n\s*\n', re.MULTILINE | re.DOTALL)
RE_TYPE = re.compile(r'^\s*([A-Z][\w-]*)?\s*([{} \t:\w-]*?)?::=([\w \t]+.*?)\n\s*\n', re.MULTILINE | re.DOTALL)
@@ -91,6 +95,12 @@ def parseText(content, indent=None):


	content = RE_POWER_SIGN.sub('<sup>\\1</sup>', content)
	content = RE_POWER_SIGN.sub('<sup>\\1</sup>', content)


	content = RE_LESSEQ_SIGN.sub('', content)

	content = RE_GREATEQ_SIGN.sub('', content)

	content = RE_REFERENCE_NUMBER.sub('[\\g<0>](#references)', content)

	return indentLines(content, indent)
	return indentLines(content, indent)


def parseInlineComments(content:str, indent=None):
def parseInlineComments(content:str, indent=None):
@@ -188,7 +198,7 @@ def parseModule(mname, content):
					else:
					else:
						ret = parseText(l)
						ret = parseText(l)
				elif m.group(1) == 'note':
				elif m.group(1) == 'note':
					s_note = '\n>>>\n' + 'NOTE: ' + parseText(l).rstrip() + '\n>>>\n'
					s_note = '\n>>>\n' + 'NOTE:&emsp;' + parseText(l).rstrip() + '\n>>>\n'
				else:
				else:
					ret = m.string[m.start():m.end()]
					ret = m.string[m.start():m.end()]
				return ret
				return ret
@@ -196,7 +206,7 @@ def parseModule(mname, content):


			def repl_category(m):
			def repl_category(m):
				nonlocal s_category
				nonlocal s_category
				s_category = '\n&nbsp;&nbsp;&nbsp;&nbsp;**Categories**: '
				s_category = '\n&nbsp;&nbsp;&nbsp;&nbsp;**Categories:** '
				for l in m.group(1).split(','):
				for l in m.group(1).split(','):
#					s_category += '[{0}](#{1}) '.format(l.strip(), urlquote(l.strip()))
#					s_category += '[{0}](#{1}) '.format(l.strip(), urlquote(l.strip()))
					s_category += parseText(l).strip() + ' '
					s_category += parseText(l).strip() + ' '
@@ -206,13 +216,13 @@ def parseModule(mname, content):


			def repl_unit(m):
			def repl_unit(m):
				nonlocal s_unit
				nonlocal s_unit
				s_unit = '\n&nbsp;&nbsp;&nbsp;&nbsp;**Unit**: _' + parseText(m.group(1)).strip() + '_\n'
				s_unit = '\n&nbsp;&nbsp;&nbsp;&nbsp;**Unit:** _' + parseText(m.group(1)).strip() + '_\n'
				return ''
				return ''
			doc = RE_DOXY_UNIT.sub(repl_unit, doc)
			doc = RE_DOXY_UNIT.sub(repl_unit, doc)


			def repl_revision(m):
			def repl_revision(m):
				nonlocal s_revision
				nonlocal s_revision
				s_revision = '\n&nbsp;&nbsp;&nbsp;&nbsp;**Revision**: _' + parseText(m.group(1)).strip() + '_\n'
				s_revision = '\n&nbsp;&nbsp;&nbsp;&nbsp;**Revision:** _' + parseText(m.group(1)).strip() + '_\n'
				return ''
				return ''
			doc = RE_DOXY_REVISION.sub(repl_revision, doc)
			doc = RE_DOXY_REVISION.sub(repl_revision, doc)
		else:
		else:
@@ -297,6 +307,13 @@ def parseModule(mname, content):
	for m in RE_TYPE.finditer(content[cpos:]):
	for m in RE_TYPE.finditer(content[cpos:]):
		ret += repl_type (m, m.string[pos:m.start()])
		ret += repl_type (m, m.string[pos:m.start()])
		pos = m.end()
		pos = m.end()
	
	v = parseText(parseOptions(parseDoxyComments(content[pos:]), m_options))
	if len(v):
		def repl_note (m):
   			return '\n>>>\n' + 'NOTE:&emsp;' + m.group(2).lstrip(":, \t").lstrip('\n').rstrip() + '\n>>>\n'
		ret += '\n\n' + RE_NOTE_SECTION.sub(repl_note, v).strip() +'\n'

	return ret
	return ret




@@ -336,7 +353,7 @@ def main():
	cnt = 0
	cnt = 0
	for a in o_args.modules:
	for a in o_args.modules:
		try:
		try:
			content = open(a, encoding='latin-1').read()
			content = open(a, mode="r", encoding='latin-1').read()
			cnt += parseAsn(o_args.out, content)
			cnt += parseAsn(o_args.out, content)
		except IOError as e:
		except IOError as e:
			sys.stderr.write(e[1]+"\n")
			sys.stderr.write(e[1]+"\n")
+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.