Skip to content

Commit 2b5d91c

Browse files
committed
Add documentation
1 parent 3f6d2d3 commit 2b5d91c

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

main.tex

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,45 @@
11
\documentclass{article}
22

3+
% TODO:
4+
% - Explain JSON5 features in detail.
5+
6+
% UTF-8 support.
37
\usepackage[utf8]{inputenc}
8+
9+
% English hyphenation and typographical settings.
410
\usepackage[english]{babel}
511

12+
% Stops tildes (~) from being superscripted.
613
\usepackage[T1]{fontenc}
714
\usepackage{lmodern}
815

16+
% Hyperlink support.
917
\usepackage{hyperref}
1018

19+
% Citations and references.
1120
\usepackage[backend=biber]{biblatex}
1221
\addbibresource{references.bib}
1322

23+
% Indentation support.
1424
\usepackage{changepage}
1525

26+
% Syntax highlighting.
1627
\usepackage{minted}
17-
\usemintedstyle{vs}
28+
\usemintedstyle{vs} % Visual Studio
29+
30+
% Stops single quotes from getting too fancy.
1831
\usepackage{upquote}
1932

33+
% Don't hyphenate these words.
2034
\hyphenation{ECMAScript}
2135

36+
37+
% Custom Commands
38+
2239
\newenvironment{gramprod}[2]{
40+
% Formats a grammar production rule.
41+
% Not intended to be used directly.
42+
% Usage: \begin{gramprod}{production-name}{punctuation}
2343
\begin{samepage}
2444
\begin{adjustwidth}{0.5cm}{0.5cm}
2545
\emph{#1} \textbf{#2}
@@ -32,24 +52,52 @@
3252
}
3353

3454
\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}
3563
\begin{gramprod}{#1}{::}
3664
}{
3765
\end{gramprod}
3866
}
3967

4068
\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}
4176
\begin{gramprod}{#1}{:}
4277
}{
4378
\end{gramprod}
4479
}
4580

4681
\newcommand{\token}[1]{\emph{#1}}
82+
% Formats a grammar token.
83+
% Usage: \token{production-name}
84+
% Example: \token{JSON5Identifier}
4785

4886
\newcommand{\lit}[1]{\textbf{\texttt{#1}}}
87+
% Formats a literal grammar token.
88+
% Usage: \lit{literal-text}
89+
% Example: \lit{Infinity}
4990

5091
\newcommand{\opt}[1]{#1\textsubscript{opt}}
92+
% Formats an optional grammar token.
93+
% Usage: \opt{token}
94+
% Example: \opt{\lit{,}}
5195

5296
\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+
53101

54102
\title{The JSON5 Data Interchange Format}
55103

0 commit comments

Comments
 (0)