Skip to content

Commit

Permalink
Merge pull request #8036 from JuliaLang/cjh/relational-algebra
Browse files Browse the repository at this point in the history
Add infix operators for relational algebra
  • Loading branch information
jiahao committed Oct 22, 2015
2 parents ea2d0f2 + 93668d1 commit e372b06
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Language changes

* `using` and `import` are now case-sensitive even on case-insensitive filesystems (common on Mac and Windows) ([#13542]).

* Relational symbols are now allowed as infix operators ([#8036]).

Command-line option changes
---------------------------

Expand Down
28 changes: 25 additions & 3 deletions base/latex_symbols.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,21 @@ end
# Additional symbols were generated from the unicode-math LaTeX package
# symbol listing, using the following script:
#=
# download("http://mirror.math.ku.edu/tex-archive/macros/latex/contrib/unicode-math/unicode-math-table.tex", "unicode-math-table.tex")
fname = "unicode-math-table.tex"
isfile(fname) || download("http://mirror.math.ku.edu/tex-archive/macros/latex/contrib/unicode-math/$fname", fname)
const latex_strings = Set(values(Base.REPLCompletions.latex_symbols))
open("unicode-math-table.tex") do f
open(fname) do f
for L in eachline(f)
x = map(s -> rstrip(s, [' ','\t','\n']),
split(replace(L, r"[{}\"]+", "\t"), "\t"))
c = Char(parse(Int, x[2], 16))
if (Base.is_id_char(c) || Base.isoperator(symbol(c))) &&
string(c) ∉ latex_strings && !isascii(c)
println(" \"", escape_string(x[3]), "\" => \"",
tabcomname = escape_string(x[3])
if startswith(tabcomname, "math")
tabcomname = tabcomname[5:end]
end
println(" \"", tabcomname, "\" => \"",
escape_string("$c"), "\", # ", x[5])
end
end
Expand Down Expand Up @@ -2543,4 +2548,21 @@ const latex_symbols = Dict(
"\\mtteight" => "𝟾", # mathematical monospace digit 8
"\\mttnine" => "𝟿", # mathematical monospace digit 9

"\\triangleright" => "", # (large) right triangle, open; z notation range restriction
"\\triangleleft" => "", # (large) left triangle, open; z notation domain restriction
"\\leftouterjoin" => "", # left outer join
"\\rightouterjoin" => "", # right outer join
"\\fullouterjoin" => "", # full outer join
"\\Join" => "", # join
"\\underbar" => "̲", # combining low line
"\\underleftrightarrow" => "͍", # underleftrightarrow accent
"\\leftwavearrow" => "", # left arrow-wavy
"\\rightwavearrow" => "", # right arrow-wavy
"\\varbarwedge" => "", # /barwedge b: logical and, bar above [projective (bar over small wedge)]
"\\smallblacktriangleright" => "", # right triangle, filled
"\\smallblacktriangleleft" => "", # left triangle, filled
"\\leftmoon" => "", # last quarter moon
"\\smalltriangleright" => "", # right triangle, open
"\\smalltriangleleft" => "", # left triangle, open

)
2 changes: 1 addition & 1 deletion src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(define prec-colon '(: |..|))
(define prec-plus '(+ - ⊕ ⊖ ⊞ ⊟ |.+| |.-| |++| |\|| ∪ ∨ $ ⊔ ± ∓ ∔ ∸ ≂ ≏ ⊎ ⊻ ⊽ ⋎ ⋓ ⧺ ⧻ ⨈ ⨢ ⨣ ⨤ ⨥ ⨦ ⨧ ⨨ ⨩ ⨪ ⨫ ⨬ ⨭ ⨮ ⨹ ⨺ ⩁ ⩂ ⩅ ⩊ ⩌ ⩏ ⩐ ⩒ ⩔ ⩖ ⩗ ⩛ ⩝ ⩡ ⩢ ⩣))
(define prec-bitshift '(<< >> >>> |.<<| |.>>| |.>>>|))
(define prec-times '(* / |./| ÷ |.÷| % ⋅ ∘ × |.%| |.*| |\\| |.\\| & ∩ ∧ ⊗ ⊘ ⊙ ⊚ ⊛ ⊠ ⊡ ⊓ ∗ ∙ ∤ ⅋ ≀ ⊼ ⋄ ⋆ ⋇ ⋉ ⋊ ⋋ ⋌ ⋏ ⋒ ⟑ ⦸ ⦼ ⦾ ⦿ ⧶ ⧷ ⨇ ⨰ ⨱ ⨲ ⨳ ⨴ ⨵ ⨶ ⨷ ⨸ ⨻ ⨼ ⨽ ⩀ ⩃ ⩄ ⩋ ⩍ ⩎ ⩑ ⩓ ⩕ ⩘ ⩚ ⩜ ⩞ ⩟ ⩠ ⫛ ⊍))
(define prec-times '(* / |./| ÷ |.÷| % ⋅ ∘ × |.%| |.*| |\\| |.\\| & ∩ ∧ ⊗ ⊘ ⊙ ⊚ ⊛ ⊠ ⊡ ⊓ ∗ ∙ ∤ ⅋ ≀ ⊼ ⋄ ⋆ ⋇ ⋉ ⋊ ⋋ ⋌ ⋏ ⋒ ⟑ ⦸ ⦼ ⦾ ⦿ ⧶ ⧷ ⨇ ⨰ ⨱ ⨲ ⨳ ⨴ ⨵ ⨶ ⨷ ⨸ ⨻ ⨼ ⨽ ⩀ ⩃ ⩄ ⩋ ⩍ ⩎ ⩑ ⩓ ⩕ ⩘ ⩚ ⩜ ⩞ ⩟ ⩠ ⫛ ⊍ ▷ ⨝ ⟕ ⟖ ⟗))
(define prec-rational '(// .//))
(define prec-power '(^ |.^| ↑ ↓ ⇵ ⟰ ⟱ ⤈ ⤉ ⤊ ⤋ ⤒ ⤓ ⥉ ⥌ ⥍ ⥏ ⥑ ⥔ ⥕ ⥘ ⥙ ⥜ ⥝ ⥠ ⥡ ⥣ ⥥ ⥮ ⥯ ↑ ↓))
(define prec-decl '(|::|))
Expand Down

0 comments on commit e372b06

Please sign in to comment.