(state, nodeIndent, flowIndent)
| 1978 | } |
| 1979 | |
| 1980 | function readBlockMapping(state, nodeIndent, flowIndent) { |
| 1981 | var following, |
| 1982 | allowCompact, |
| 1983 | _line, |
| 1984 | _pos, |
| 1985 | _tag = state.tag, |
| 1986 | _anchor = state.anchor, |
| 1987 | _result = {}, |
| 1988 | overridableKeys = {}, |
| 1989 | keyTag = null, |
| 1990 | keyNode = null, |
| 1991 | valueNode = null, |
| 1992 | atExplicitKey = false, |
| 1993 | detected = false, |
| 1994 | ch; |
| 1995 | |
| 1996 | if (state.anchor !== null) { |
| 1997 | state.anchorMap[state.anchor] = _result; |
| 1998 | } |
| 1999 | |
| 2000 | ch = state.input.charCodeAt(state.position); |
| 2001 | |
| 2002 | while (ch !== 0) { |
| 2003 | following = state.input.charCodeAt(state.position + 1); |
| 2004 | _line = state.line; // Save the current line. |
| 2005 | _pos = state.position; |
| 2006 | |
| 2007 | // |
| 2008 | // Explicit notation case. There are two separate blocks: |
| 2009 | // first for the key (denoted by "?") and second for the value (denoted by ":") |
| 2010 | // |
| 2011 | if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { |
| 2012 | |
| 2013 | if (ch === 0x3F/* ? */) { |
| 2014 | if (atExplicitKey) { |
| 2015 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); |
| 2016 | keyTag = keyNode = valueNode = null; |
| 2017 | } |
| 2018 | |
| 2019 | detected = true; |
| 2020 | atExplicitKey = true; |
| 2021 | allowCompact = true; |
| 2022 | |
| 2023 | } else if (atExplicitKey) { |
| 2024 | // i.e. 0x3A/* : */ === character after the explicit key. |
| 2025 | atExplicitKey = false; |
| 2026 | allowCompact = true; |
| 2027 | |
| 2028 | } else { |
| 2029 | throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); |
| 2030 | } |
| 2031 | |
| 2032 | state.position += 1; |
| 2033 | ch = following; |
| 2034 | |
| 2035 | // |
| 2036 | // Implicit notation case. Flow-style node as the key first, then ":", and the value. |
| 2037 | // |
no test coverage detected