|
1 | 1 | \documentclass{article} |
2 | 2 |
|
| 3 | +% TODO: |
| 4 | +% - Explain JSON5 features in detail. |
| 5 | + |
| 6 | +% UTF-8 support. |
3 | 7 | \usepackage[utf8]{inputenc} |
| 8 | + |
| 9 | +% English hyphenation and typographical settings. |
4 | 10 | \usepackage[english]{babel} |
5 | 11 |
|
| 12 | +% Stops tildes (~) from being superscripted. |
6 | 13 | \usepackage[T1]{fontenc} |
7 | 14 | \usepackage{lmodern} |
8 | 15 |
|
| 16 | +% Hyperlink support. |
9 | 17 | \usepackage{hyperref} |
10 | 18 |
|
| 19 | +% Citations and references. |
11 | 20 | \usepackage[backend=biber]{biblatex} |
12 | 21 | \addbibresource{references.bib} |
13 | 22 |
|
| 23 | +% Indentation support. |
14 | 24 | \usepackage{changepage} |
15 | 25 |
|
| 26 | +% Syntax highlighting. |
16 | 27 | \usepackage{minted} |
17 | | -\usemintedstyle{vs} |
| 28 | +\usemintedstyle{vs} % Visual Studio |
| 29 | + |
| 30 | +% Stops single quotes from getting too fancy. |
18 | 31 | \usepackage{upquote} |
19 | 32 |
|
| 33 | +% Don't hyphenate these words. |
20 | 34 | \hyphenation{ECMAScript} |
21 | 35 |
|
| 36 | + |
| 37 | +% Custom Commands |
| 38 | + |
22 | 39 | \newenvironment{gramprod}[2]{ |
| 40 | +% Formats a grammar production rule. |
| 41 | +% Not intended to be used directly. |
| 42 | +% Usage: \begin{gramprod}{production-name}{punctuation} |
23 | 43 | \begin{samepage} |
24 | 44 | \begin{adjustwidth}{0.5cm}{0.5cm} |
25 | 45 | \emph{#1} \textbf{#2} |
|
32 | 52 | } |
33 | 53 |
|
34 | 54 | \newenvironment{lexprod}[1]{ |
| 55 | +% Formats a lexical grammar production rule. |
| 56 | +% Usage: \begin{lexprod}{production-name} |
| 57 | +% Example: |
| 58 | +% \begin{lexprod}{JSON5Number} |
| 59 | +% \token{JSON5NumericLiteral}\\ |
| 60 | +% \lit{+} \token{JSON5NumericLiteral}\\ |
| 61 | +% \lit{-} \token{JSON5NumericLiteral} |
| 62 | +% \end{lexprod} |
35 | 63 | \begin{gramprod}{#1}{::} |
36 | 64 | }{ |
37 | 65 | \end{gramprod} |
38 | 66 | } |
39 | 67 |
|
40 | 68 | \newenvironment{synprod}[1]{ |
| 69 | +% Formats a syntactic grammar production rule. |
| 70 | +% Usage: \begin{synprod}{production-name} |
| 71 | +% Example: |
| 72 | +% \begin{synprod}{JSON5MemberName} |
| 73 | +% \token{JSON5Identifier}\\ |
| 74 | +% \token{JSON5String} |
| 75 | +% \end{synprod} |
41 | 76 | \begin{gramprod}{#1}{:} |
42 | 77 | }{ |
43 | 78 | \end{gramprod} |
44 | 79 | } |
45 | 80 |
|
46 | 81 | \newcommand{\token}[1]{\emph{#1}} |
| 82 | +% Formats a grammar token. |
| 83 | +% Usage: \token{production-name} |
| 84 | +% Example: \token{JSON5Identifier} |
47 | 85 |
|
48 | 86 | \newcommand{\lit}[1]{\textbf{\texttt{#1}}} |
| 87 | +% Formats a literal grammar token. |
| 88 | +% Usage: \lit{literal-text} |
| 89 | +% Example: \lit{Infinity} |
49 | 90 |
|
50 | 91 | \newcommand{\opt}[1]{#1\textsubscript{opt}} |
| 92 | +% Formats an optional grammar token. |
| 93 | +% Usage: \opt{token} |
| 94 | +% Example: \opt{\lit{,}} |
51 | 95 |
|
52 | 96 | \newcommand{\esref}[2]{\href{https://es5.github.io/\#x#2}{#1}} |
| 97 | +% Creates a hyperlink to Annotated ES5 spec. |
| 98 | +% Usage: \esref{text}{section} |
| 99 | +% Example: \esref{BooleanLiteral}{7.8.2} |
| 100 | + |
53 | 101 |
|
54 | 102 | \title{The JSON5 Data Interchange Format} |
55 | 103 |
|
|
0 commit comments