miso
Copyright(C) 2016-2026 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Miso.JSON.Lexer

Description

Overview

Miso.JSON.Lexer is the first stage of miso's pure Haskell JSON pipeline, which is used for server-side rendering (SSR). It tokenises a MisoString into a stream of Token values consumed by Miso.JSON.Parser.

This module is internal. Application code should use Miso.JSON or Miso.JSON.Parser (decodePure) instead.

This module was ported from https://github.com/dmjio/json-test by @ners.

Token types

data Token
  = TokenPunctuator Char    -- one of [ ] { } , :
  | TokenNumber     Double  -- JSON number (integer or floating-point)
  | TokenBool       Bool    -- true or false
  | TokenString     MisoString -- quoted string with escape sequences
  | TokenNull               -- null

String tokens handle all RFC 8259 escape sequences including \uXXXX and UTF-16 surrogate pairs (\uD800\uDC00).

See also

Documentation

data Token Source #

Instances

Instances details
Show Token Source # 
Instance details

Defined in Miso.JSON.Lexer

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

Eq Token Source # 
Instance details

Defined in Miso.JSON.Lexer

Methods

(==) :: Token -> Token -> Bool #

(/=) :: Token -> Token -> Bool #