Fixed comment parsing bug.

[?]
Jun 16, 2021, 12:23 PM
JUK3ONMUIR5CVOMELN6JGTUH7N2F3CRWTPI2BH747IXR3BJIYJDQC

Dependencies

  • [2] POIIOD4L Improved broken comment error message.
  • [3] 6ZJX2OQV First commit
  • [4] VDFODD2F Added line to BadIndent error.

Change contents

  • edit in src/parser.rs at line 325
    [3.12765]
    [3.12765]
  • edit in src/parser.rs at line 327
    [3.12766]
    [3.12766]
    (PS::COK, Char::ForwardSlash) => {
    parse_state = PS::CM;
    },
  • replacement in src/parser.rs at line 362
    [2.51][2.51:96]()
    Line::new(line),
    [2.51]
    [3.1175]
    Line::new(line + 1),
  • edit in src/parser.rs at line 417
    [3.15101][3.15101:15213](),[3.15213][3.2085:2187](),[3.2187][2.97:193](),[2.193][3.2237:2287](),[3.2237][3.2237:2287](),[3.2287][3.15315:15334](),[3.15315][3.15315:15334]()
    (PS::COK, Char::ForwardSlash) => {
    let token_str = &s[start_key..=pos - 1];
    return Err(Error::new(
    ErrorKind::IncompleteCommentOrKey(
    token_str.to_string(),
    Line::new(line),
    )
    ));
    },
  • replacement in src/error.rs at line 330
    [3.44953][3.44953:45006]()
    "\"/\" is an incomplete comment or key",
    [3.44953]
    [3.45006]
    "\"/\" at line 2 is an incomplete comment or key.",
  • edit in src/error.rs at line 332
    [3.45016]
    [3.45016]
    }
    #[test]
    fn indented_comment_parses() {
    assert!(KeyTree::parse("key:\n // comment").is_ok());
  • edit in src/error.rs at line 338
    [3.45022]
    [3.45022]
    #[test]
    fn non_indented_comment_parses() {
    assert!(KeyTree::parse("key:\n// comment").is_ok());
    }
  • replacement in src/error.rs at line 360
    [3.45418][3.45418:45471]()
    "\"/\" is an incomplete comment or key",
    [3.45418]
    [3.45471]
    "\"/\" at line 1 is an incomplete comment or key.",