# Path: chemdataextractor/parse/elements.py
# W = Word
# 
# T = Tag
# 
# R = Regex
# 
# class Optional(ParseElementEnhance):
# 
#     def __init__(self, expr):
#         super(Optional, self).__init__(expr)
# 
#     def _parse_tokens(self, tokens, i, actions=True):
#         results = []
#         try:
#             results, i = self.expr.parse(tokens, i, actions)
#         except (ParseException, IndexError):
#             pass
#         return results, i


import logging
import re
from .elements import W, T, R, Optional
roman_numeral = R('^(I|II|III|IV|V|VI|VII|VIII|IX|XI|XII|XIII|XIV)$', re.I)

# Punctuation delimiter that is hidden
delim = R('^[,:;\.\[\]\(\)\{\}/]$').hide()
optdelim = Optional(delim)

# CEM: optdelim = Optional(R('^[;:,\.\(\)]$').hide())
# cont: delim = Optional(R('^[;:,\.\(\)]$').hide())
# MP: delim = R('^[:;\.]$')
# IR: delim = R('^[;:,\./]$').hide()
# NMR: delim = R('^[;:,\.]$').hide()
# table: delims = ZeroOrMore(R('^[,;\[\]\(\)\{\}/]$'))

# Brackets. (Note that these could be tagged other than LRB/RRB e.g. as part of CM entity)
lbrct = W('(').hide()
rbrct = W(')').hide()

# All hyphen and minus characters. Probably more robust than the hyph POS tag.
hyphen = R('^[\-‐‑⁃‒–—―−－⁻]$')

# All quote and apostrophe characters
quote = R('^[\'’՚Ꞌꞌ＇‘’‚‛"“”„‟`´’‘]$')

slash = W('/')

# Symbols
degree = W('°')
times = W('×')
lmbda = W('λ')
epsilon = W('ε')

# Path: chemdataextractor/parse/elements.py
# W = Word
# 
# T = Tag
# 
# R = Regex
# 
# class Optional(ParseElementEnhance):
# 
#     def __init__(self, expr):
#         super(Optional, self).__init__(expr)
# 
#     def _parse_tokens(self, tokens, i, actions=True):
#         results = []
#         try:
#             results, i = self.expr.parse(tokens, i, actions)
#         except (ParseException, IndexError):
#             pass
#         return results, i


# Path: chemdataextractor/parse/common.py
import logging
import re
from .elements import W, T, R, Optional

roman_numeral = R('^(I|II|III|IV|V|VI|VII|VIII|IX|XI|XII|XIII|XIV)$', re.I)

# Punctuation delimiter that is hidden
delim = R('^[,:;\.\[\]\(\)\{\}/]$').hide()
optdelim = Optional(delim)

# CEM: optdelim = Optional(R('^[;:,\.\(\)]$').hide())
# cont: delim = Optional(R('^[;:,\.\(\)]$').hide())
# MP: delim = R('^[:;\.]$')
# IR: delim = R('^[;:,\./]$').hide()
# NMR: delim = R('^[;:,\.]$').hide()
# table: delims = ZeroOrMore(R('^[,;\[\]\(\)\{\}/]$'))

# Brackets. (Note that these could be tagged other than LRB/RRB e.g. as part of CM entity)
lbrct = W('(').hide()
rbrct = W(')').hide()

# All hyphen and minus characters. Probably more robust than the hyph POS tag.
hyphen = R('^[\-‐‑⁃‒–—―−－⁻]$')

# All quote and apostrophe characters
quote = R('^[\'’՚Ꞌꞌ＇‘’‚‛"“”„‟`´’‘]$')

slash = W('/')

# Symbols
degree = W('°')
times = W('×')
lmbda = W('λ')
epsilon = W('ε')

equals = W('=')