This file is indexed.

/usr/share/doc/pccts/examples/sorcerer/testcpp/test3.sor is in pccts 1.33MR33-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* Test of tree rewriting */
#header <<
#include <stdio.h>
#include <string.h>
#include "SCommonAST.h"

class wacko {
protected:
	char text[50];
public:
	char *getText()			{ return text; }
};

class SORAST : public SORCommonAST, public wacko {
public:
	SORAST() {setType(0);}
	SORAST(int tok, char *s);
	void lisp_action(FILE *f);
	PCCTS_AST *shallowCopy();
};
>>

#tokdefs "token3.h"

<<
/* This constr is implicitly called when you ref node constructor #[tok,s] */
SORAST::SORAST(int tok, char *s)
{
    setType(tok);
    strcpy(getText(), s);
}

void SORAST::
lisp_action(FILE *f)
{
	fprintf(f, " %s", getText());
}

PCCTS_AST *SORAST::
shallowCopy()
{
	SORAST *p = new SORAST();
	*p = *this;
	p->setDown(NULL);
	p->setRight(NULL);
	return p;
}
>>

<<
main()
{
    SORAST *a, *b, *c, *d, *e, *f, *g;
    SORAST *result = NULL;
    Cool myparser;
	int n;

	/* M a k e  I n p u t  T r e e  T o  P a r s e */
    /* var 'b' expr is ( + c ( * a b ) ) == "c + a * b" */
	a = #[Mult,"*"];
	a->addChild(#[Var,"a"]);
	a->addChild(#[Var,"b"]);
	b = #[Plus,"+"];
	b->addChild(#[Var,"c"]);
	b->addChild(a);

	n = b->ast_scan("#( Plus %1:Var #( Mult %2:Var %3:Var ) )", &e,&f,&g);
	printf("scan(\"#( Plus %%1:Var #( Mult %%2:Var %%3:Var ) )\")\n");
	printf("on tree: ");
	b->lisp(stdout);
	printf("\nresults: found %d successful matches\n", n);

	printf("tree parser input: "); b->lisp(stdout); printf("\n");
    myparser.expr((SORASTBase **)&b, (SORASTBase **)&result);
	printf("tree parser output: "); result->lisp(stdout); printf("\n");
}
>>

class Cool {

/* Reverse order of Plus's and kill 2nd operand of mult */

expr:!  #(a:Plus b:expr c:expr) <<#expr = (SORASTBase *)#(a,c,b);>>
    |   #(Mult expr! expr)
    |	Var
    ;

}