# HG changeset patch # User wenzelm # Date 1390654509 -3600 # Node ID 687656233ad85967ff0bebb714bd83ef30aa4388 # Parent 9808f186795ce5bc695c3979cb73002557830eb3 simplified inner syntax; diff -r 9808f186795c -r 687656233ad8 src/HOL/ex/Cartouche_Examples.thy --- a/src/HOL/ex/Cartouche_Examples.thy Fri Jan 24 16:54:25 2014 +0000 +++ b/src/HOL/ex/Cartouche_Examples.thy Sat Jan 25 13:55:09 2014 +0100 @@ -52,35 +52,35 @@ end; *} -syntax "_STR_cartouche" :: "cartouche_position \ string" ("STR _") +syntax "_cartouche_string" :: "cartouche_position \ string" ("_") parse_translation {* - [(@{syntax_const "_STR_cartouche"}, + [(@{syntax_const "_cartouche_string"}, K (string_tr (Symbol_Pos.cartouche_content o Symbol_Pos.explode)))] *} -term "STR \\" -term "STR \abc\" -term "STR \abc\ @ STR \xyz\" -term "STR \\\" -term "STR \\001\010\100\" +term "\\" +term "\abc\" +term "\abc\ @ \xyz\" +term "\\\" +term "\\001\010\100\" subsection {* Alternate outer and inner syntax: string literals *} subsubsection {* Nested quotes *} -syntax "_STR_string" :: "string_position \ string" ("STR _") +syntax "_string_string" :: "string_position \ string" ("_") parse_translation {* - [(@{syntax_const "_STR_string"}, K (string_tr Lexicon.explode_string))] + [(@{syntax_const "_string_string"}, K (string_tr Lexicon.explode_string))] *} -term "STR \"\"" -term "STR \"abc\"" -term "STR \"abc\" @ STR \"xyz\"" -term "STR \"\\"" -term "STR \"\001\010\100\"" +term "\"\"" +term "\"abc\"" +term "\"abc\" @ \"xyz\"" +term "\"\\"" +term "\"\001\010\100\"" subsubsection {* Term cartouche and regular quotes *} @@ -95,11 +95,11 @@ in writeln (Syntax.string_of_term ctxt t) end))) *} -term_cartouche \STR ""\ -term_cartouche \STR "abc"\ -term_cartouche \STR "abc" @ STR "xyz"\ -term_cartouche \STR "\"\ -term_cartouche \STR "\001\010\100"\ +term_cartouche \""\ +term_cartouche \"abc"\ +term_cartouche \"abc" @ "xyz"\ +term_cartouche \"\"\ +term_cartouche \"\001\010\100"\ subsubsection {* Further nesting: antiquotations *} @@ -125,22 +125,22 @@ *} ML {* - @{term_cartouche \STR ""\}; - @{term_cartouche \STR "abc"\}; - @{term_cartouche \STR "abc" @ STR "xyz"\}; - @{term_cartouche \STR "\"\}; - @{term_cartouche \STR "\001\010\100"\}; + @{term_cartouche \""\}; + @{term_cartouche \"abc"\}; + @{term_cartouche \"abc" @ "xyz"\}; + @{term_cartouche \"\"\}; + @{term_cartouche \"\001\010\100"\}; *} text {* @{ML_cartouche \ ( - @{term_cartouche \STR ""\}; - @{term_cartouche \STR "abc"\}; - @{term_cartouche \STR "abc" @ STR "xyz"\}; - @{term_cartouche \STR "\"\}; - @{term_cartouche \STR "\001\010\100"\} + @{term_cartouche \""\}; + @{term_cartouche \"abc"\}; + @{term_cartouche \"abc" @ "xyz"\}; + @{term_cartouche \"\"\}; + @{term_cartouche \"\001\010\100"\} ) \ } @@ -160,11 +160,11 @@ @{ML_cartouche \ ( - @{term_cartouche \STR ""\}; - @{term_cartouche \STR "abc"\}; - @{term_cartouche \STR "abc" @ STR "xyz"\}; - @{term_cartouche \STR "\"\}; - @{term_cartouche \STR "\001\010\100"\} + @{term_cartouche \""\}; + @{term_cartouche \"abc"\}; + @{term_cartouche \"abc" @ "xyz"\}; + @{term_cartouche \"\"\}; + @{term_cartouche \"\001\010\100"\} ) \ }