Skip to content

Possible CI check: bad use of \grammarterm #1543

Closed
@Eelis

Description

@Eelis
Contributor

It's pretty easy to get lists of uses of \grammarterm and \nontermdef, and to compare them:

grep -oP --no-filename '(?<=\\nontermdef{)[^}]*(?=})' *.tex | sort | uniq > defined_grammarterms.txt
grep -oP --no-filename '(?<=\\grammarterm{)[^}]*(?=})' *.tex | tr A-Z a-z | sort | uniq > used_grammarterms.txt
comm -23 used_grammarterms.txt defined_grammarterms.txt

This finds the following uses of \grammarterm that don't have a corresponding \nontermdef:

attribute-specifier-seq\opt
begin-expr
brace-or-equal-initializers
call-function
class-name-or-namespace-name
copy-list-initialization
cv-list
cv-qualifer-seq
cv-qualifiers
cv-qualifier-seq\opt
decl-specifiers
default-initialize
direct-list-initialization
dynamic-cast
end-expr
explicitly-defaulted
function-local predefined variable
function-name
function-specifiers
init-declarators
initializer-list constructor
injected-class-name
integer-constant
integer representation of a safely-derived pointer
italic
label
list-initialization
local
mem-initializers
more cv-qualified
nested
nested-name-specifier\opt
non-trivial
non-type argument
non-type parameter
non-virtual
over-aligned type
overloaded
ref-qualifier\opt
root-directory\opt
root-name\opt
root-path
safely-derived pointer
standard-layout class
standard-layout struct
standard-layout union
switch-statement
tem\-plate-argument
template-argument-list.
typedef
type-dependent
typeid
unnamed
user-defined conversion sequence
using-directives
value-dependent
x
x-id
x-list
x-name
x-seq
zero-initialize

I think at most a couple of these are ok, all the rest are bad as far as I can tell.

So maybe this could be a Travis check, possibly with a short whitelist. I suppose all current bad uses would have to be fixed first though. Thoughts?

Activity

Eelis

Eelis commented on Mar 16, 2017

@Eelis
ContributorAuthor

Update: Recent commits fixed a lot of bad uses! The list now is:

attribute-specifier-seq\opt
begin-expr
call-function
class-name-or-namespace-name
cv-list
cv-qualifier-seq\opt
dot
dot-dot
end-expr
explicitly-defaulted
function-local predefined variable
function-name
initializer-list constructor
injected-class-name
integer-constant
italic
list-initialization
nested-name-specifier\opt
non-trivial
non-type argument
non-type parameter
non-virtual
over-aligned type
overloaded
ref-qualifier\opt
root-directory\opt
root-name\opt
root-path
x
x-id
x-list
x-name
x-seq
Eelis

Eelis commented on Mar 18, 2017

@Eelis
ContributorAuthor

Update: Capitalized \grammarterms are also considered bad, see #1519. Removing the tr A-Z a-z from the script, the list becomes:

attribute-specifier-seq\opt
begin-expr
call-function
class-name-or-namespace-name
Class-specifier
cv-list
cv-qualifier-seq\opt
dot
dot-dot
end-expr
explicitly-defaulted
Function-definition
function-local predefined variable
function-name
Function-specifier
injected-class-name
integer-constant
italic
Namespace-definition
nested-name-specifier\opt
non-trivial
non-type argument
non-type parameter
non-virtual
over-aligned type
overloaded
ref-qualifier\opt
root-directory\opt
root-name\opt
root-path
X
X-id
X-list
X-name
X-seq
Eelis

Eelis commented on Mar 20, 2017

@Eelis
ContributorAuthor

Recent commits fixed many bad uses, reducing the list to:

call-function
class-name-or-namespace-name
Class-specifier
cv-list
dot
dot-dot
explicitly-defaulted
Function-definition
function-local predefined variable
function-name
Function-specifier
injected-class-name
integer-constant
italic
Namespace-definition
root-path
X
X-id
X-list
X-name
X-seq

We're nearly there! :)

Eelis

Eelis commented on Oct 17, 2017

@Eelis
ContributorAuthor

Update: by now the list has been reduced to:

call-function
class-name-or-namespace-name
dot
dot-dot
italic
parameter
preprocessing-tokens
root-path
x
x-id
x-list
x-name
x-seq
jensmaurer

jensmaurer commented on Dec 1, 2017

@jensmaurer
Member

dot and dot-dot are addressed by #1527.
x-something is from the introduction in [syntax]; the "x" is a placeholder. I don't think we should change this.

Eelis

Eelis commented on Dec 10, 2017

@Eelis
ContributorAuthor

In my last update, I forgot to include the capitalized grammarterms that are also considered bad (#1519). These also still exist:

classes.tex:25:\grammarterm{Class-specifier}{s} and
declarations.tex:82:\grammarterm{Function-definition}{s} are described in~\ref{dcl.fct.def} and
declarations.tex:496:\grammarterm{Function-specifier}{s}
declarations.tex:85:\grammarterm{Namespace-definition}{s} are described in~\ref{namespace.def},
jensmaurer

jensmaurer commented on Feb 13, 2018

@jensmaurer
Member

#1858 fixed the last remnants of these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Eelis@jensmaurer

        Issue actions

          Possible CI check: bad use of \grammarterm · Issue #1543 · cplusplus/draft