def literal_to_ObjectLiteral(self, literal: ShExDocParser.LiteralContext) -> ShExJ.ObjectLiteral:
rval = ShExJ.ObjectLiteral()<EOL>if literal.rdfLiteral():<EOL><INDENT>rdflit = literal.rdfLiteral()<EOL>txt = rdflit.string().getText()<EOL>quote_char = '<STR_LIT>'<EOL>if len(txt) > <NUM_LIT:5> and (txt.startswith("<STR_LIT>") and txt.endswith("<STR_LIT>") or<EOL>txt.startswith('<STR_LIT>') and txt.endswith('<STR_LIT>')):<EOL><INDENT>txt = txt[<NUM_LIT:3>:-<NUM_LIT:3>]<EOL><DEDENT>else:<EOL><INDENT>quote_char = txt[<NUM_LIT:0>]<EOL>txt = txt[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL><DEDENT>txt = self.fix_text_escapes(txt, quote_char)<EOL>rval.value = jsg.String(txt)<EOL>if rdflit.LANGTAG():<EOL><INDENT>rval.language = ShExJ.LANGTAG(rdflit.LANGTAG().getText()[<NUM_LIT:1>:].lower())<EOL><DEDENT>if rdflit.datatype():<EOL><INDENT>rval.type = self.iri_to_str(rdflit.datatype().iri())<EOL><DEDENT><DEDENT>elif literal.numericLiteral():<EOL><INDENT>numlit = literal.numericLiteral()<EOL>if numlit.INTEGER():<EOL><INDENT>rval.value = jsg.String(numlit.INTEGER().getText())<EOL>rval.type = RDF_INTEGER_TYPE<EOL><DEDENT>elif numlit.DECIMAL():<EOL><INDENT>rval.value = jsg.String(numlit.DECIMAL().getText())<EOL>rval.type = RDF_DECIMAL_TYPE<EOL><DEDENT>elif numlit.DOUBLE():<EOL><INDENT>rval.value = jsg.String(numlit.DOUBLE().getText())<EOL>rval.type = RDF_DOUBLE_TYPE<EOL><DEDENT><DEDENT>elif literal.booleanLiteral():<EOL><INDENT>rval.value = jsg.String(literal.booleanLiteral().getText().lower())<EOL>rval.type = RDF_BOOL_TYPE<EOL><DEDENT>return rval<EOL>
literal: rdfLiteral | numericLiteral | booleanLiteral