Failed to parse some nix files from `nixpkgs`
I ran the parser against all .nix
files in the nixpkgs
repo to see how it compares to the standard nix parser. The vast majority of files passed, but there's a handful of files that did not. Here's a list:
Could not parse nixpkgs/doc/shell.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/lib/generators.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/lib/tests/release.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/nixos/lib/build-vms.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/nixos/lib/testing.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/nixos/maintainers/option-usages.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/nixos/modules/services/networking/monero.nix:
parse error: undefined token
Could not parse nixpkgs/nixos/tests/installer.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/applications/misc/lyx/default.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/applications/networking/browsers/chromium/plugins.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/applications/networking/browsers/firefox/wrapper.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/applications/networking/instant-messengers/mikutter/shell.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/applications/version-management/redmine/bootstrap.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/applications/window-managers/yabar/unstable.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/build-support/buildenv/default.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/build-support/cc-wrapper/default.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/build-support/fetchurl/default.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/build-support/release/default.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/build-support/trivial-builders.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/data/icons/tango-icon-theme/default.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/desktops/gnome-2/default.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/development/beam-modules/fetch-hex.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/development/compilers/mono/generic.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/development/interpreters/erlang/generic-builder.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/development/libraries/db/generic.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/development/libraries/gobject-introspection/default.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/development/libraries/goffice/0.8.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/development/libraries/mesa/default.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/development/libraries/webkitgtk/2.4.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/development/libraries/wildmidi/default.nix:
parse error: paths cannot have a trailing slash
Could not parse nixpkgs/pkgs/development/tools/misc/gdbgui/requirements.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/games/steam/runtime-mirror.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/misc/emulators/cdemu/base.nix:
parse error: expected Colon, found Some(CurlyBClose)
Could not parse nixpkgs/pkgs/misc/emulators/wine/sources.nix:
parse error: expected Colon, found Some(CurlyBClose)
Here's the short snippet of code I used to run the parser:
extern crate rnix;
use std::{env, fs};
fn main() {
let filename = match env::args().skip(1).next() {
Some(file) => file,
None => {
eprintln!("Usage: dump-ast <file>");
return;
}
};
let content = match fs::read_to_string(&filename) {
Ok(content) => content,
Err(err) => {
eprintln!("Error reading file: {}", err);
return;
}
};
match rnix::parse(&content) {
Ok(ast) => {}, //println!("{:#?}", ast),
Err(err) => {
println!("Could not parse {}:", &filename);
println!("\t{}", err);
}
};
}