Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add infix operators for relational algebra #8036

Merged
merged 3 commits into from
Oct 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -16,7 +16,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